Class: WhopSDK::Resources::ForumPosts

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

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:



151
152
153
# File 'lib/whop_sdk/resources/forum_posts.rb', line 151

def initialize(client:)
  @client = client
end

Instance Method Details

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

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

Create a new forum post

Required permissions:

  • ‘forum:post:create`

Parameters:

  • experience_id (String)

    The experience to create this post in

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

    The attachments for this post

  • content (String, nil)

    This is the main body of the post in Markdown format. Hidden if paywalled and us

  • is_mention (Boolean, nil)

    This is used to determine if the post should be sent as a ‘mention’ notification

  • parent_id (String, nil)

    The ID of the parent post. Set it to the ID of the post you want to comment on o

  • paywall_amount (Float, nil)

    The amount to paywall this post by. A paywalled post requires the user to purcha

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

    The available currencies on the platform

  • pinned (Boolean, nil)

    Whether the post should be pinned

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

    The poll for this post

  • title (String, nil)

    The title of the post. Only visible if paywalled.

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

Returns:

See Also:



42
43
44
45
46
47
48
49
50
51
# File 'lib/whop_sdk/resources/forum_posts.rb', line 42

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>

Lists forum posts

Required permissions:

  • ‘forum:read`

Parameters:

  • experience_id (String)

    The ID 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 ID of the parent post to list forum post comments for

  • pinned (Boolean, nil)

    Set to true to only return pinned posts

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

Returns:

See Also:



136
137
138
139
140
141
142
143
144
145
146
# File 'lib/whop_sdk/resources/forum_posts.rb', line 136

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

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

Retrieves a forum post by ID

Required permissions:

  • ‘forum:read`

Parameters:

Returns:

See Also:



67
68
69
70
71
72
73
74
# File 'lib/whop_sdk/resources/forum_posts.rb', line 67

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, request_options: {}) ⇒ WhopSDK::Models::ForumPost

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

Update an existing forum post

Parameters:

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

    The attachments for this post

  • content (String, nil)

    This is the main body of the post in Markdown format. Hidden if paywalled and us

  • is_pinned (Boolean, nil)

    Whether the post is pinned. You can only pin a top level posts (not comments).

  • title (String, nil)

    The title of the post. Only visible if paywalled.

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

Returns:

See Also:



98
99
100
101
102
103
104
105
106
107
# File 'lib/whop_sdk/resources/forum_posts.rb', line 98

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