Class: Knockapi::Resources::Providers::Slack

Inherits:
Object
  • Object
show all
Defined in:
lib/knockapi/resources/providers/slack.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Slack

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Slack.



85
86
87
# File 'lib/knockapi/resources/providers/slack.rb', line 85

def initialize(client:)
  @client = client
end

Instance Method Details

#check_auth(channel_id, access_token_object:, request_options: {}) ⇒ Knockapi::Models::Providers::SlackCheckAuthResponse

Check if a Slack channel is authenticated.



20
21
22
23
24
25
26
27
28
29
# File 'lib/knockapi/resources/providers/slack.rb', line 20

def check_auth(channel_id, params)
  parsed, options = Knockapi::Providers::SlackCheckAuthParams.dump_request(params)
  @client.request(
    method: :get,
    path: ["v1/providers/slack/%1$s/auth_check", channel_id],
    query: parsed,
    model: Knockapi::Models::Providers::SlackCheckAuthResponse,
    options: options
  )
end

#list_channels(channel_id, access_token_object:, query_options: nil, request_options: {}) ⇒ Knockapi::Internal::SlackChannelsCursor<Knockapi::Models::Providers::SlackListChannelsResponse>

List Slack channels for a Slack workspace.



46
47
48
49
50
51
52
53
54
55
56
# File 'lib/knockapi/resources/providers/slack.rb', line 46

def list_channels(channel_id, params)
  parsed, options = Knockapi::Providers::SlackListChannelsParams.dump_request(params)
  @client.request(
    method: :get,
    path: ["v1/providers/slack/%1$s/channels", channel_id],
    query: parsed,
    page: Knockapi::Internal::SlackChannelsCursor,
    model: Knockapi::Models::Providers::SlackListChannelsResponse,
    options: options
  )
end

#revoke_access(channel_id, access_token_object:, request_options: {}) ⇒ Knockapi::Models::Providers::SlackRevokeAccessResponse

Revoke access for a Slack channel.



71
72
73
74
75
76
77
78
79
80
# File 'lib/knockapi/resources/providers/slack.rb', line 71

def revoke_access(channel_id, params)
  parsed, options = Knockapi::Providers::SlackRevokeAccessParams.dump_request(params)
  @client.request(
    method: :put,
    path: ["v1/providers/slack/%1$s/revoke_access", channel_id],
    query: parsed,
    model: Knockapi::Models::Providers::SlackRevokeAccessResponse,
    options: options
  )
end