Class: WhopSDK::Resources::Forums

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Forums

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

Parameters:



101
102
103
# File 'lib/whop_sdk/resources/forums.rb', line 101

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::ForumListResponse>

Lists forums inside a company

Required permissions:

  • ‘forum:read`

Parameters:

  • company_id (String)

    The ID of the company to list forums 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)

    If provided, only forums connected to this product are returned

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

Returns:

See Also:



86
87
88
89
90
91
92
93
94
95
96
# File 'lib/whop_sdk/resources/forums.rb', line 86

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

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

Retrieves a forum

Required permissions:

  • ‘forum:read`

Parameters:

Returns:

See Also:



20
21
22
23
24
25
26
27
# File 'lib/whop_sdk/resources/forums.rb', line 20

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

#update(id, email_notification_preference: nil, who_can_comment: nil, who_can_post: nil, request_options: {}) ⇒ WhopSDK::Models::Forum

Updates a forum

Required permissions:

  • ‘forum:moderate`

Parameters:

Returns:

See Also:



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

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