Class: SlackWebApi::MigrationController

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

Overview

MigrationController

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

#migration_exchange(token, users, team_id: nil, to_old: nil) ⇒ ApiResponse

For Enterprise Grid workspaces, map local user IDs to global user IDs scope: tokens.basic ids, up to 400 per request T in case of Org Token to convert W global user IDs to workspace-specific U IDs. Defaults to false.

Parameters:

  • token (String)

    Required parameter: Authentication token. Requires

  • users (String)

    Required parameter: A comma-separated list of user

  • team_id (String) (defaults to: nil)

    Optional parameter: Specify team_id starts with

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

    Optional parameter: Specify true

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



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

def migration_exchange(token,
                       users,
                       team_id: nil,
                       to_old: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/migration.exchange',
                                 Server::DEFAULT)
               .query_param(new_parameter(token, key: 'token')
                             .is_required(true))
               .query_param(new_parameter(users, key: 'users')
                             .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(to_old, key: 'to_old'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('slackAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(MigrationExchangeSuccessSchema.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Typical error response when there are no mappings to provide',
                             MigrationExchangeErrorSchemaException))
    .execute
end