Class: SlackWebApi::AppsPermissionsUsersController

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

Overview

AppsPermissionsUsersController

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

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

Returns list of user grants and corresponding scopes this app has on a team. scope: none data by setting the cursor parameter to a next_cursor attribute returned by a previous request’s response_metadata. Default value fetches the first “page” of the collection. See [pagination](/docs/pagination) for more detail. return.

Parameters:

  • token (String)

    Required parameter: Authentication token. Requires

  • cursor (String) (defaults to: nil)

    Optional parameter: Paginate through collections of

  • limit (Integer) (defaults to: nil)

    Optional parameter: The maximum number of items to

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



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/apps_permissions_users_controller.rb', line 21

def apps_permissions_users_list(token,
                                cursor: nil,
                                limit: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/apps.permissions.users.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

#apps_permissions_users_request(token, scopes, trigger_id, user) ⇒ ApiResponse

Enables an app to trigger a permissions modal to grant an app access to a user access scope. scope: none scopes to request for request requested for

Parameters:

  • token (String)

    Required parameter: Authentication token. Requires

  • scopes (String)

    Required parameter: A comma separated list of user

  • trigger_id (String)

    Required parameter: Token used to trigger the

  • user (String)

    Required parameter: The user this scope is being

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/slack_web_api/controllers/apps_permissions_users_controller.rb', line 56

def apps_permissions_users_request(token,
                                   scopes,
                                   trigger_id,
                                   user)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/apps.permissions.users.request',
                                 Server::DEFAULT)
               .query_param(new_parameter(token, key: 'token')
                             .is_required(true))
               .query_param(new_parameter(scopes, key: 'scopes')
                             .is_required(true))
               .query_param(new_parameter(trigger_id, key: 'trigger_id')
                             .is_required(true))
               .query_param(new_parameter(user, key: 'user')
                             .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',
                             'Standard failure response when trigger_id is invalid',
                             DefaultErrorTemplateException))
    .execute
end