Class: WhopSDK::Resources::DmChannels
- Inherits:
-
Object
- Object
- WhopSDK::Resources::DmChannels
- Defined in:
- lib/whop_sdk/resources/dm_channels.rb
Overview
Dm channels
Instance Method Summary collapse
-
#create(with_user_ids:, company_id: nil, custom_name: nil, request_options: {}) ⇒ WhopSDK::Models::DmChannel
Some parameter documentations has been truncated, see Models::DmChannelCreateParams for more details.
-
#delete(id, request_options: {}) ⇒ Boolean
Permanently delete a DM channel and all of its messages.
-
#initialize(client:) ⇒ DmChannels
constructor
private
A new instance of DmChannels.
-
#list(after: nil, before: nil, company_id: nil, first: nil, last: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::DmChannelListResponse>
Some parameter documentations has been truncated, see Models::DmChannelListParams for more details.
-
#retrieve(id, request_options: {}) ⇒ WhopSDK::Models::DmChannel
Retrieves the details of an existing DM channel.
-
#update(id, custom_name: nil, request_options: {}) ⇒ WhopSDK::Models::DmChannel
Some parameter documentations has been truncated, see Models::DmChannelUpdateParams for more details.
Constructor Details
#initialize(client:) ⇒ DmChannels
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 DmChannels.
161 162 163 |
# File 'lib/whop_sdk/resources/dm_channels.rb', line 161 def initialize(client:) @client = client end |
Instance Method Details
#create(with_user_ids:, company_id: nil, custom_name: nil, request_options: {}) ⇒ WhopSDK::Models::DmChannel
Some parameter documentations has been truncated, see Models::DmChannelCreateParams for more details.
Create a new DM channel between two or more users, optionally scoped to a specific company. Returns the existing channel if one already exists.
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/whop_sdk/resources/dm_channels.rb', line 26 def create(params) parsed, = WhopSDK::DmChannelCreateParams.dump_request(params) @client.request( method: :post, path: "dm_channels", body: parsed, model: WhopSDK::DmChannel, options: ) end |
#delete(id, request_options: {}) ⇒ Boolean
Permanently delete a DM channel and all of its messages. Only an admin of the channel can perform this action.
Required permissions:
-
‘dms:channel:manage`
149 150 151 152 153 154 155 156 |
# File 'lib/whop_sdk/resources/dm_channels.rb', line 149 def delete(id, params = {}) @client.request( method: :delete, path: ["dm_channels/%1$s", id], model: WhopSDK::Internal::Type::Boolean, options: params[:request_options] ) end |
#list(after: nil, before: nil, company_id: nil, first: nil, last: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::DmChannelListResponse>
Some parameter documentations has been truncated, see Models::DmChannelListParams for more details.
Returns a paginated list of DM channels for the currently authenticated user, sorted by most recently active.
Required permissions:
-
‘dms:read`
120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/whop_sdk/resources/dm_channels.rb', line 120 def list(params = {}) parsed, = WhopSDK::DmChannelListParams.dump_request(params) query = WhopSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "dm_channels", query: query, page: WhopSDK::Internal::CursorPage, model: WhopSDK::Models::DmChannelListResponse, options: ) end |
#retrieve(id, request_options: {}) ⇒ WhopSDK::Models::DmChannel
Retrieves the details of an existing DM channel.
Required permissions:
-
‘dms:read`
52 53 54 55 56 57 58 59 |
# File 'lib/whop_sdk/resources/dm_channels.rb', line 52 def retrieve(id, params = {}) @client.request( method: :get, path: ["dm_channels/%1$s", id], model: WhopSDK::DmChannel, options: params[:request_options] ) end |
#update(id, custom_name: nil, request_options: {}) ⇒ WhopSDK::Models::DmChannel
Some parameter documentations has been truncated, see Models::DmChannelUpdateParams for more details.
Update the settings of an existing DM channel, such as its display name. Only an admin of the channel can perform this action.
Required permissions:
-
‘dms:channel:manage`
82 83 84 85 86 87 88 89 90 91 |
# File 'lib/whop_sdk/resources/dm_channels.rb', line 82 def update(id, params = {}) parsed, = WhopSDK::DmChannelUpdateParams.dump_request(params) @client.request( method: :patch, path: ["dm_channels/%1$s", id], body: parsed, model: WhopSDK::DmChannel, options: ) end |