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

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

Overview

A provider represents a third-party service that Knock integrates with and is configured via a channel.

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.

Parameters:



90
91
92
# File 'lib/knockapi/resources/providers/slack.rb', line 90

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.

Parameters:

  • channel_id (String)

    The ID of the Knock Slack channel to check.

  • access_token_object (String)

    A JSON encoded string containing the access token object reference.

  • request_options (Knockapi::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



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

def check_auth(channel_id, params)
  parsed, options = Knockapi::Providers::SlackCheckAuthParams.dump_request(params)
  query = Knockapi::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["v1/providers/slack/%1$s/auth_check", channel_id],
    query: query,
    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.

Parameters:

Returns:

See Also:



49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/knockapi/resources/providers/slack.rb', line 49

def list_channels(channel_id, params)
  parsed, options = Knockapi::Providers::SlackListChannelsParams.dump_request(params)
  query = Knockapi::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["v1/providers/slack/%1$s/channels", channel_id],
    query: query,
    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.

Parameters:

  • channel_id (String)

    The ID of the Knock Slack channel to revoke access for.

  • access_token_object (String)

    A JSON encoded string containing the access token object reference.

  • request_options (Knockapi::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



75
76
77
78
79
80
81
82
83
84
85
# File 'lib/knockapi/resources/providers/slack.rb', line 75

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