Class: SlackWebApi::AdminUsergroupsController

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

Overview

AdminUsergroupsController

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_usergroups_add_channels(token, usergroup_id, channel_ids, team_id: nil) ⇒ ApiResponse

Add one or more default channels to an IDP group. scope: admin.usergroups:write add default channels for. channel IDs. channels in.

Parameters:

  • token (String)

    Required parameter: Authentication token. Requires

  • usergroup_id (String)

    Required parameter: ID of the IDP group to

  • channel_ids (String)

    Required parameter: Comma separated string of

  • team_id (String) (defaults to: nil)

    Optional parameter: The workspace to add default

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

def admin_usergroups_add_channels(token,
                                  usergroup_id,
                                  channel_ids,
                                  team_id: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/admin.usergroups.addChannels',
                                 Server::DEFAULT)
               .header_param(new_parameter(token, key: 'token')
                              .is_required(true))
               .form_param(new_parameter(usergroup_id, key: 'usergroup_id')
                            .is_required(true))
               .form_param(new_parameter(channel_ids, key: 'channel_ids')
                            .is_required(true))
               .form_param(new_parameter(team_id, key: 'team_id'))
               .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 if the token provided is not associated'\
                              ' with an Org Admin or Owner',
                             DefaultErrorTemplateException))
    .execute
end

#admin_usergroups_add_teams(token, usergroup_id, team_ids, auto_provision: nil) ⇒ ApiResponse

Associate one or more default workspaces with an organization-wide IDP group. scope: admin.teams:write Group) ID. encoded team (workspace) IDs. Each workspace MUST belong to the organization associated with the token. true, this method automatically creates new workspace accounts for the IDP group members.

Parameters:

  • token (String)

    Required parameter: Authentication token. Requires

  • usergroup_id (String)

    Required parameter: An encoded usergroup (IDP

  • team_ids (String)

    Required parameter: A comma separated list of

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

    Optional parameter: When

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



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/admin_usergroups_controller.rb', line 61

def admin_usergroups_add_teams(token,
                               usergroup_id,
                               team_ids,
                               auto_provision: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/admin.usergroups.addTeams',
                                 Server::DEFAULT)
               .header_param(new_parameter(token, key: 'token')
                              .is_required(true))
               .form_param(new_parameter(usergroup_id, key: 'usergroup_id')
                            .is_required(true))
               .form_param(new_parameter(team_ids, key: 'team_ids')
                            .is_required(true))
               .form_param(new_parameter(auto_provision, key: 'auto_provision'))
               .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_usergroups_list_channels(token, usergroup_id, team_id: nil, include_num_members: nil) ⇒ ApiResponse

List the channels linked to an org-level IDP group (user group). scope: admin.usergroups:read list default channels for. Flag to include or exclude the count of members per channel.

Parameters:

  • token (String)

    Required parameter: Authentication token. Requires

  • usergroup_id (String)

    Required parameter: ID of the IDP group to

  • team_id (String) (defaults to: nil)

    Optional parameter: ID of the the workspace.

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

    Optional parameter:

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/slack_web_api/controllers/admin_usergroups_controller.rb', line 98

def admin_usergroups_list_channels(token,
                                   usergroup_id,
                                   team_id: nil,
                                   include_num_members: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/admin.usergroups.listChannels',
                                 Server::DEFAULT)
               .header_param(new_parameter(token, key: 'token')
                              .is_required(true))
               .query_param(new_parameter(usergroup_id, key: 'usergroup_id')
                             .is_required(true))
               .header_param(new_parameter('application/x-www-form-urlencoded', key: 'Content-Type'))
               .query_param(new_parameter(team_id, key: 'team_id'))
               .query_param(new_parameter(include_num_members, key: 'include_num_members'))
               .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 if the token provided is not associated'\
                              ' with an Org Admin or Owner',
                             DefaultErrorTemplateException))
    .execute
end

#admin_usergroups_remove_channels(token, usergroup_id, channel_ids) ⇒ ApiResponse

Remove one or more default channels from an org-level IDP group (user group). scope: admin.usergroups:write channel IDs

Parameters:

  • token (String)

    Required parameter: Authentication token. Requires

  • usergroup_id (String)

    Required parameter: ID of the IDP Group

  • channel_ids (String)

    Required parameter: Comma-separated string of

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/slack_web_api/controllers/admin_usergroups_controller.rb', line 134

def admin_usergroups_remove_channels(token,
                                     usergroup_id,
                                     channel_ids)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/admin.usergroups.removeChannels',
                                 Server::DEFAULT)
               .header_param(new_parameter(token, key: 'token')
                              .is_required(true))
               .form_param(new_parameter(usergroup_id, key: 'usergroup_id')
                            .is_required(true))
               .form_param(new_parameter(channel_ids, key: 'channel_ids')
                            .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 if the token provided is not associated'\
                              ' with an Org Admin or Owner',
                             DefaultErrorTemplateException))
    .execute
end