Class: WhopSDK::Resources::Reactions

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Reactions

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

Parameters:



98
99
100
# File 'lib/whop_sdk/resources/reactions.rb', line 98

def initialize(client:)
  @client = client
end

Instance Method Details

#create(resource_id: , emoji: nil, request_options: {}) ⇒ WhopSDK::Models::Reaction

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

Creates a new reaction

Required permissions:

  • ‘chat:read`

Parameters:

  • resource_id (String)

    The ID of the post or message to react to.

  • emoji (String, nil)

    The emoji to react with (e.g., :heart: or ‘😀’). It will be ignored in forums, a

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

Returns:

See Also:



26
27
28
29
30
31
32
33
34
35
# File 'lib/whop_sdk/resources/reactions.rb', line 26

def create(params)
  parsed, options = WhopSDK::ReactionCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "reactions",
    body: parsed,
    model: WhopSDK::Reaction,
    options: options
  )
end

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

Lists reactions for a post or a message

Required permissions:

  • ‘chat:read`

Parameters:

  • resource_id (String)

    The ID of the post or message to list reactions 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.

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

Returns:

See Also:



83
84
85
86
87
88
89
90
91
92
93
# File 'lib/whop_sdk/resources/reactions.rb', line 83

def list(params)
  parsed, options = WhopSDK::ReactionListParams.dump_request(params)
  @client.request(
    method: :get,
    path: "reactions",
    query: parsed,
    page: WhopSDK::Internal::CursorPage,
    model: WhopSDK::Models::ReactionListResponse,
    options: options
  )
end

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

Retrieves a reaction

Required permissions:

  • ‘chat:read`

Parameters:

Returns:

See Also:



51
52
53
54
55
56
57
58
# File 'lib/whop_sdk/resources/reactions.rb', line 51

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