Class: WhopSDK::Resources::ForumPosts

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

Overview

Forum posts

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ ForumPosts

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

Parameters:



171
172
173
# File 'lib/whop_sdk/resources/forum_posts.rb', line 171

def initialize(client:)
  @client = client
end

Instance Method Details

#create(experience_id:, attachments: nil, company_id: nil, content: nil, is_mention: nil, parent_id: nil, paywall_amount: nil, paywall_currency: nil, pinned: nil, poll: nil, rich_content: nil, title: nil, visibility: nil, request_options: {}) ⇒ WhopSDK::Models::ForumPost

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

Create a new forum post or comment within an experience. Supports text content, attachments, polls, paywalling, and pinning. Pass experience_id ‘public’ with a company_id to post to a company’s public forum.

Required permissions:

  • ‘forum:post:create`

**upd

Parameters:

  • experience_id (String)

    The unique identifier of the experience to create this post in. For example, ‘ex

  • attachments (Array<WhopSDK::Models::ForumPostCreateParams::Attachment>, nil)

    A list of file attachments to include with the post, such as images or videos.

  • company_id (String, nil)

    The unique identifier of the company whose public forum to post in. Required whe

  • content (String, nil)

    The main body of the post in Markdown format. For example, ‘Check out this

  • is_mention (Boolean, nil)

    Whether to send this post as a mention notification to all users in the experien

  • parent_id (String, nil)

    The unique identifier of the parent post to comment on. Omit this field to creat

  • paywall_amount (Float, nil)

    The price to unlock this post in the specified paywall currency. For example, 5.

  • paywall_currency (Symbol, WhopSDK::Models::Currency, nil)

    The available currencies on the platform

  • pinned (Boolean, nil)

    Whether this post should be pinned to the top of the forum.

  • poll (WhopSDK::Models::ForumPostCreateParams::Poll, nil)

    A poll to attach to this post, allowing members to vote on options.

  • rich_content (String, nil)

    The rich content of the post in Tiptap JSON format. When provided, takes priorit

  • title (String, nil)

    The title of the post, displayed prominently at the top. Required for paywalled

  • visibility (Symbol, WhopSDK::Models::ForumPostVisibilityType, nil)

    The visibility types for forum posts

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

Returns:

See Also:



52
53
54
55
56
57
58
59
60
61
# File 'lib/whop_sdk/resources/forum_posts.rb', line 52

def create(params)
  parsed, options = WhopSDK::ForumPostCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "forum_posts",
    body: parsed,
    model: WhopSDK::ForumPost,
    options: options
  )
end

#list(experience_id:, after: nil, before: nil, first: nil, last: nil, parent_id: nil, pinned: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::ForumPostListResponse>

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

Returns a paginated list of forum posts within a specific experience, with optional filtering by parent post or pinned status.

Required permissions:

  • ‘forum:read`

Parameters:

  • experience_id (String)

    The unique identifier of the experience to list forum posts 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.

  • parent_id (String, nil)

    The unique identifier of a parent post to list comments for. When set, returns r

  • pinned (Boolean, nil)

    Whether to filter for only pinned posts. Set to true to return only pinned posts

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

Returns:

See Also:



155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/whop_sdk/resources/forum_posts.rb', line 155

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

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

Retrieves the details of an existing forum post.

Required permissions:

  • ‘forum:read`

Parameters:

  • id (String)

    The unique identifier of the forum post to retrieve.

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

Returns:

See Also:



78
79
80
81
82
83
84
85
# File 'lib/whop_sdk/resources/forum_posts.rb', line 78

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

#update(id, attachments: nil, content: nil, is_pinned: nil, title: nil, visibility: nil, request_options: {}) ⇒ WhopSDK::Models::ForumPost

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

Edit the content, attachments, pinned status, or visibility of an existing forum post or comment.

**

Parameters:

  • id (String)

    The unique identifier of the forum post to update.

  • attachments (Array<WhopSDK::Models::ForumPostUpdateParams::Attachment>, nil)

    A replacement list of file attachments for this post, such as images or videos.

  • content (String, nil)

    The updated body of the post in Markdown format. For example, ‘Check out this

  • is_pinned (Boolean, nil)

    Whether this post should be pinned to the top of the forum. Only top-level posts

  • title (String, nil)

    The updated title of the post, displayed prominently at the top. Required for pa

  • visibility (Symbol, WhopSDK::Models::ForumPostVisibilityType, nil)

    The visibility types for forum posts

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

Returns:

See Also:



113
114
115
116
117
118
119
120
121
122
# File 'lib/whop_sdk/resources/forum_posts.rb', line 113

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