Class: WhopSDK::Resources::SupportChannels

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ SupportChannels

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

Parameters:



105
106
107
# File 'lib/whop_sdk/resources/support_channels.rb', line 105

def initialize(client:)
  @client = client
end

Instance Method Details

#create(company_id: , user_id: , request_options: {}) ⇒ WhopSDK::Models::SupportChannel

Create a new support channel for a user in a company. If one already exists, it will return the existing one.

Required permissions:

  • ‘support_chat:create`

Parameters:

  • company_id (String)

    The ID of the company to create the support chat in

  • user_id (String)

    The ID of the user to create the support chat for

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

Returns:

See Also:



24
25
26
27
28
29
30
31
32
33
# File 'lib/whop_sdk/resources/support_channels.rb', line 24

def create(params)
  parsed, options = WhopSDK::SupportChannelCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "support_channels",
    body: parsed,
    model: WhopSDK::SupportChannel,
    options: options
  )
end

#list(company_id: , after: nil, before: nil, direction: nil, first: nil, last: nil, open_: nil, order: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::SupportChannelListResponse>

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

Lists chat channels inside a company

Required permissions:

  • ‘support_chat:read`

Parameters:

  • company_id (String)

    The ID 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.

  • direction (Symbol, WhopSDK::Models::Direction, nil)

    The direction of the sort.

  • first (Integer, nil)

    Returns the first n elements from the list.

  • last (Integer, nil)

    Returns the last n elements from the list.

  • open_ (Boolean, nil)

    Filter for tickets where customer sent the last message (needs response) AND not

  • order (Symbol, WhopSDK::Models::SupportChannelListParams::Order, nil)

    Sort options for message channels

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

Returns:

See Also:



90
91
92
93
94
95
96
97
98
99
100
# File 'lib/whop_sdk/resources/support_channels.rb', line 90

def list(params)
  parsed, options = WhopSDK::SupportChannelListParams.dump_request(params)
  @client.request(
    method: :get,
    path: "support_channels",
    query: parsed.transform_keys(open_: "open"),
    page: WhopSDK::Internal::CursorPage,
    model: WhopSDK::Models::SupportChannelListResponse,
    options: options
  )
end

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

Retrieves a support channel

Required permissions:

  • ‘support_chat:read`

Parameters:

Returns:

See Also:



49
50
51
52
53
54
55
56
# File 'lib/whop_sdk/resources/support_channels.rb', line 49

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