Class: WhopSDK::Resources::Messages
- Inherits:
-
Object
- Object
- WhopSDK::Resources::Messages
- Defined in:
- lib/whop_sdk/resources/messages.rb,
sig/whop_sdk/resources/messages.rbs
Instance Method Summary collapse
-
#create(channel_id:, content:, attachments: nil, auto_detect_links: nil, poll: nil, replying_to_message_id: nil, request_options: {}) ⇒ WhopSDK::Models::Message
Some parameter documentations has been truncated, see Models::MessageCreateParams for more details.
-
#delete(id, request_options: {}) ⇒ Boolean
Permanently delete a message from an experience chat, DM, or group chat channel.
-
#initialize(client:) ⇒ Messages
constructor
private
A new instance of Messages.
-
#list(channel_id:, after: nil, before: nil, direction: nil, first: nil, last: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::MessageListResponse>
Returns a paginated list of messages within a specific experience chat, DM, or group chat channel, sorted by creation time.
-
#retrieve(id, request_options: {}) ⇒ WhopSDK::Models::Message
Retrieves the details of an existing message.
-
#update(id, attachments: nil, content: nil, is_pinned: nil, request_options: {}) ⇒ WhopSDK::Models::Message
Some parameter documentations has been truncated, see Models::MessageUpdateParams for more details.
Constructor Details
#initialize(client:) ⇒ Messages
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 Messages.
170 171 172 |
# File 'lib/whop_sdk/resources/messages.rb', line 170 def initialize(client:) @client = client end |
Instance Method Details
#create(channel_id:, content:, attachments: nil, auto_detect_links: nil, poll: nil, replying_to_message_id: nil, request_options: {}) ⇒ WhopSDK::Models::Message
Some parameter documentations has been truncated, see Models::MessageCreateParams for more details.
Send a new message in an experience chat, DM, or group chat channel. Supports text content, attachments, polls, and replies.
Required permissions:
chat:message:create
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/whop_sdk/resources/messages.rb', line 35 def create(params) parsed, = WhopSDK::MessageCreateParams.dump_request(params) @client.request( method: :post, path: "messages", body: parsed, model: WhopSDK::Message, options: ) end |
#delete(id, request_options: {}) ⇒ Boolean
Permanently delete a message from an experience chat, DM, or group chat channel. Only the message author or a channel admin can delete a message.
Required permissions:
chat:message:create
158 159 160 161 162 163 164 165 |
# File 'lib/whop_sdk/resources/messages.rb', line 158 def delete(id, params = {}) @client.request( method: :delete, path: ["messages/%1$s", id], model: WhopSDK::Internal::Type::Boolean, options: params[:request_options] ) end |
#list(channel_id:, after: nil, before: nil, direction: nil, first: nil, last: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::MessageListResponse>
Returns a paginated list of messages within a specific experience chat, DM, or group chat channel, sorted by creation time.
Required permissions:
chat:read
129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/whop_sdk/resources/messages.rb', line 129 def list(params) parsed, = WhopSDK::MessageListParams.dump_request(params) query = WhopSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "messages", query: query, page: WhopSDK::Internal::CursorPage, model: WhopSDK::Models::MessageListResponse, options: ) end |
#retrieve(id, request_options: {}) ⇒ WhopSDK::Models::Message
Retrieves the details of an existing message.
Required permissions:
chat:read
61 62 63 64 65 66 67 68 |
# File 'lib/whop_sdk/resources/messages.rb', line 61 def retrieve(id, params = {}) @client.request( method: :get, path: ["messages/%1$s", id], model: WhopSDK::Message, options: params[:request_options] ) end |
#update(id, attachments: nil, content: nil, is_pinned: nil, request_options: {}) ⇒ WhopSDK::Models::Message
Some parameter documentations has been truncated, see Models::MessageUpdateParams for more details.
Edit the content, attachments, or pinned status of an existing message in an experience chat, DM, or group chat channel.
'Hello *_world_
92 93 94 95 96 97 98 99 100 101 |
# File 'lib/whop_sdk/resources/messages.rb', line 92 def update(id, params = {}) parsed, = WhopSDK::MessageUpdateParams.dump_request(params) @client.request( method: :patch, path: ["messages/%1$s", id], body: parsed, model: WhopSDK::Message, options: ) end |