Class: WhopSDK::Resources::ChatChannels

Inherits:
Object
  • Object
show all
Defined in:
lib/whop_sdk/resources/chat_channels.rb

Overview

Chat channels

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ ChatChannels

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 ChatChannels.

Parameters:



118
119
120
# File 'lib/whop_sdk/resources/chat_channels.rb', line 118

def initialize(client:)
  @client = client
end

Instance Method Details

#list(company_id:, after: nil, before: nil, first: nil, last: nil, product_id: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::ChatChannelListResponse>

Some parameter documentations has been truncated, see Models::ChatChannelListParams for more details.

Returns a paginated list of chat channels within a specific company, with optional filtering by product.

Required permissions:

  • ‘chat:read`

Parameters:

  • company_id (String)

    The unique identifier of the company to list chat channels for.

  • after (String, nil)

    Returns the elements in the list that come after the specified cursor.

  • before (String, nil)

    Returns the elements in the list that come before the specified cursor.

  • first (Integer, nil)

    Returns the first n elements from the list.

  • last (Integer, nil)

    Returns the last n elements from the list.

  • product_id (String, nil)

    The unique identifier of a product to filter by. When set, only chat channels co

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

Returns:

See Also:



102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/whop_sdk/resources/chat_channels.rb', line 102

def list(params)
  parsed, options = WhopSDK::ChatChannelListParams.dump_request(params)
  query = WhopSDK::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "chat_channels",
    query: query,
    page: WhopSDK::Internal::CursorPage,
    model: WhopSDK::Models::ChatChannelListResponse,
    options: options
  )
end

#retrieve(id, request_options: {}) ⇒ WhopSDK::Models::ChatChannel

Retrieves the details of an existing chat channel.

Required permissions:

  • ‘chat:read`

Parameters:

  • id (String)

    The unique identifier of the chat channel or experience to retrieve.

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

Returns:

See Also:



22
23
24
25
26
27
28
29
# File 'lib/whop_sdk/resources/chat_channels.rb', line 22

def retrieve(id, params = {})
  @client.request(
    method: :get,
    path: ["chat_channels/%1$s", id],
    model: WhopSDK::ChatChannel,
    options: params[:request_options]
  )
end

#update(id, ban_media: nil, ban_urls: nil, banned_words: nil, user_posts_cooldown_seconds: nil, who_can_post: nil, who_can_react: nil, request_options: {}) ⇒ WhopSDK::Models::ChatChannel

Some parameter documentations has been truncated, see Models::ChatChannelUpdateParams for more details.

Update moderation settings for a chat channel, such as who can post, banned words, and media restrictions.

Required permissions:

  • ‘chat:moderate`

Parameters:

  • id (String)

    The unique identifier of the chat channel to update. Accepts either an experienc

  • ban_media (Boolean, nil)

    Whether media uploads such as images and videos are banned in this chat channel.

  • ban_urls (Boolean, nil)

    Whether URLs and links are banned from being posted in this chat channel.

  • banned_words (Array<String>, nil)

    A list of words that are automatically blocked from messages in this chat channe

  • user_posts_cooldown_seconds (Integer, nil)

    The minimum number of seconds a user must wait between sending messages in this

  • who_can_post (Symbol, WhopSDK::Models::WhoCanPost, nil)

    Who can post on a chat feed

  • who_can_react (Symbol, WhopSDK::Models::WhoCanReact, nil)

    Who can react on a chat feed

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

Returns:

See Also:



62
63
64
65
66
67
68
69
70
71
# File 'lib/whop_sdk/resources/chat_channels.rb', line 62

def update(id, params = {})
  parsed, options = WhopSDK::ChatChannelUpdateParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["chat_channels/%1$s", id],
    body: parsed,
    model: WhopSDK::ChatChannel,
    options: options
  )
end