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:



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

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:

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:



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

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:



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

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:

Returns:

See Also:



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

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