Class: Attio::Resources::Threads Private
- Defined in:
- lib/attio/resources/threads.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
API resource for managing threads in Attio
Threads represent conversations or discussion topics related to records.
Instance Method Summary collapse
-
#add_participants(id:, user_ids:) ⇒ Hash
private
Add participants to a thread.
-
#close(id:) ⇒ Hash
private
Close a thread.
-
#create(parent_object:, parent_record_id:, title:, **data) ⇒ Hash
private
Create a new thread.
-
#delete(id:) ⇒ Hash
private
Delete a thread.
-
#get(id:, include_comments: false) ⇒ Hash
private
Get a specific thread by ID.
-
#list(parent_object:, parent_record_id:, **params) ⇒ Hash
private
List threads for a parent record.
-
#remove_participants(id:, user_ids:) ⇒ Hash
private
Remove participants from a thread.
-
#reopen(id:) ⇒ Hash
private
Reopen a closed thread.
-
#update(id:, **data) ⇒ Hash
private
Update an existing thread.
- #validate_user_ids!(user_ids) ⇒ Object private private
Constructor Details
This class inherits a constructor from Attio::Resources::Base
Instance Method Details
#add_participants(id:, user_ids:) ⇒ Hash
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.
Add participants to a thread
129 130 131 132 133 |
# File 'lib/attio/resources/threads.rb', line 129 def add_participants(id:, user_ids:) validate_id!(id, "Thread") validate_user_ids!(user_ids) request(:post, "threads/#{id}/participants", { user_ids: user_ids }) end |
#close(id:) ⇒ Hash
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.
Close a thread
95 96 97 98 |
# File 'lib/attio/resources/threads.rb', line 95 def close(id:) validate_id!(id, "Thread") request(:patch, "threads/#{id}", { status: "closed" }) end |
#create(parent_object:, parent_record_id:, title:, **data) ⇒ Hash
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.
Create a new thread
62 63 64 65 66 67 68 69 70 71 |
# File 'lib/attio/resources/threads.rb', line 62 def create(parent_object:, parent_record_id:, title:, **data) validate_parent!(parent_object, parent_record_id) validate_required_string!(title, "Thread title") request(:post, "threads", data.merge( parent_object: parent_object, parent_record_id: parent_record_id, title: title )) end |
#delete(id:) ⇒ Hash
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.
Delete a thread
117 118 119 120 |
# File 'lib/attio/resources/threads.rb', line 117 def delete(id:) validate_id!(id, "Thread") request(:delete, "threads/#{id}") end |
#get(id:, include_comments: false) ⇒ Hash
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.
Get a specific thread by ID
44 45 46 47 48 |
# File 'lib/attio/resources/threads.rb', line 44 def get(id:, include_comments: false) validate_id!(id, "Thread") params = include_comments ? { include: "comments" } : {} request(:get, "threads/#{id}", params) end |
#list(parent_object:, parent_record_id:, **params) ⇒ Hash
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.
List threads for a parent record
29 30 31 32 33 34 35 |
# File 'lib/attio/resources/threads.rb', line 29 def list(parent_object:, parent_record_id:, **params) validate_parent!(parent_object, parent_record_id) request(:get, "threads", params.merge( parent_object: parent_object, parent_record_id: parent_record_id )) end |
#remove_participants(id:, user_ids:) ⇒ Hash
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.
Remove participants from a thread
142 143 144 145 146 |
# File 'lib/attio/resources/threads.rb', line 142 def remove_participants(id:, user_ids:) validate_id!(id, "Thread") validate_user_ids!(user_ids) request(:delete, "threads/#{id}/participants", { user_ids: user_ids }) end |
#reopen(id:) ⇒ Hash
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.
Reopen a closed thread
106 107 108 109 |
# File 'lib/attio/resources/threads.rb', line 106 def reopen(id:) validate_id!(id, "Thread") request(:patch, "threads/#{id}", { status: "open" }) end |
#update(id:, **data) ⇒ Hash
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.
Update an existing thread
83 84 85 86 87 |
# File 'lib/attio/resources/threads.rb', line 83 def update(id:, **data) validate_id!(id, "Thread") validate_data!(data, "Update") request(:patch, "threads/#{id}", data) end |
#validate_user_ids!(user_ids) ⇒ Object (private)
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.
148 149 150 151 |
# File 'lib/attio/resources/threads.rb', line 148 private def validate_user_ids!(user_ids) raise ArgumentError, "User IDs are required" if user_ids.nil? || user_ids.empty? raise ArgumentError, "User IDs must be an array" unless user_ids.is_a?(Array) end |