Class: SlackWebApi::AdminTeamsController

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

Overview

AdminTeamsController

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_teams_create(token, team_domain, team_name, team_description: nil, team_discoverability: nil) ⇒ ApiResponse

Create an Enterprise team. scope: admin.teams:write slacksoftballteam). Slack Softball Team). team. team. A team’s discoverability can be open, closed, invite_only, or unlisted.

Parameters:

  • token (String)

    Required parameter: Authentication token. Requires

  • team_domain (String)

    Required parameter: Team domain (for example,

  • team_name (String)

    Required parameter: Team name (for example,

  • team_description (String) (defaults to: nil)

    Optional parameter: Description for the

  • team_discoverability (String) (defaults to: nil)

    Optional parameter: Who can join the

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/slack_web_api/controllers/admin_teams_controller.rb', line 22

def admin_teams_create(token,
                       team_domain,
                       team_name,
                       team_description: nil,
                       team_discoverability: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/admin.teams.create',
                                 Server::DEFAULT)
               .header_param(new_parameter(token, key: 'token')
                              .is_required(true))
               .form_param(new_parameter(team_domain, key: 'team_domain')
                            .is_required(true))
               .form_param(new_parameter(team_name, key: 'team_name')
                            .is_required(true))
               .form_param(new_parameter(team_description, key: 'team_description'))
               .form_param(new_parameter(team_discoverability, key: 'team_discoverability'))
               .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_teams_list(token, limit: nil, cursor: nil) ⇒ ApiResponse

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

Parameters:

  • token (String)

    Required parameter: Authentication token. Requires

  • limit (Integer) (defaults to: nil)

    Optional parameter: The maximum number of items to

  • cursor (String) (defaults to: nil)

    Optional parameter: Set cursor to next_cursor

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

def admin_teams_list(token,
                     limit: nil,
                     cursor: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/admin.teams.list',
                                 Server::DEFAULT)
               .header_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(limit, key: 'limit'))
               .query_param(new_parameter(cursor, key: 'cursor'))
               .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