Class: Attio::Resources::Lists Private
- Defined in:
- lib/attio/resources/lists.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 Attio lists and list entries
Lists are custom collections for organizing records in your workspace.
Instance Method Summary collapse
-
#assert_entry(id_or_slug:, matching_attribute:, data:) ⇒ Hash
private
Assert (upsert) a list entry.
-
#create(data:) ⇒ Hash
private
Create a new list.
- #create_entry(id:, data:) ⇒ Object private
- #delete_entry(list_id:, entry_id:) ⇒ Object private
- #entries(id:, **params) ⇒ Object private
- #get(id:) ⇒ Object private
- #get_entry(list_id:, entry_id:) ⇒ Object private
- #list(**params) ⇒ Object private
-
#query_entries(id_or_slug:, filter: nil, sort: nil, limit: nil, offset: nil) ⇒ Hash
private
Query list entries with advanced filtering and sorting.
-
#update(id_or_slug:, data:) ⇒ Hash
private
Update an existing list.
-
#update_entry(id_or_slug:, entry_id:, data:) ⇒ Hash
private
Update an existing list entry.
-
#validate_list_data!(data) ⇒ Object
private
private
Validates that the list data parameter is present and valid.
- #validate_list_entry_data!(data) ⇒ Object private private
Constructor Details
This class inherits a constructor from Attio::Resources::Base
Instance Method Details
#assert_entry(id_or_slug:, matching_attribute:, 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.
Assert (upsert) a list entry.
Creates or updates a list entry based on a matching attribute. This is an upsert operation that will create a new entry if no match is found, or update an existing entry if a match is found based on the specified matching attribute.
Required scopes: list_entry:read-write, list_configuration:read
178 179 180 181 182 183 184 185 186 187 188 189 |
# File 'lib/attio/resources/lists.rb', line 178 def assert_entry(id_or_slug:, matching_attribute:, data:) validate_id!(id_or_slug, "List") validate_required_string!(matching_attribute, "Matching attribute") validate_list_entry_data!(data) request_body = { data: data, matching_attribute: matching_attribute, } request(:put, "lists/#{id_or_slug}/entries", request_body) end |
#create(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 list.
Creates a new list with the specified configuration. The list can be associated with a parent object type and configured with various options.
69 70 71 72 |
# File 'lib/attio/resources/lists.rb', line 69 def create(data:) validate_list_data!(data) request(:post, "lists", { data: data }) end |
#create_entry(id:, data:) ⇒ Object
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.
29 30 31 32 33 |
# File 'lib/attio/resources/lists.rb', line 29 def create_entry(id:, data:) validate_id!(id, "List") validate_list_entry_data!(data) request(:post, "lists/#{id}/entries", data) end |
#delete_entry(list_id:, entry_id:) ⇒ Object
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.
41 42 43 44 45 |
# File 'lib/attio/resources/lists.rb', line 41 def delete_entry(list_id:, entry_id:) validate_id!(list_id, "List") validate_id!(entry_id, "Entry") request(:delete, "lists/#{list_id}/entries/#{entry_id}") end |
#entries(id:, **params) ⇒ Object
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.
24 25 26 27 |
# File 'lib/attio/resources/lists.rb', line 24 def entries(id:, **params) validate_id!(id, "List") request(:get, "lists/#{id}/entries", params) end |
#get(id:) ⇒ Object
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.
19 20 21 22 |
# File 'lib/attio/resources/lists.rb', line 19 def get(id:) validate_id!(id, "List") request(:get, "lists/#{id}") end |
#get_entry(list_id:, entry_id:) ⇒ Object
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.
35 36 37 38 39 |
# File 'lib/attio/resources/lists.rb', line 35 def get_entry(list_id:, entry_id:) validate_id!(list_id, "List") validate_id!(entry_id, "Entry") request(:get, "lists/#{list_id}/entries/#{entry_id}") end |
#list(**params) ⇒ Object
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.
15 16 17 |
# File 'lib/attio/resources/lists.rb', line 15 def list(**params) request(:get, "lists", params) end |
#query_entries(id_or_slug:, filter: nil, sort: nil, limit: nil, offset: nil) ⇒ 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.
Query list entries with advanced filtering and sorting.
Provides advanced querying capabilities for list entries, supporting complex filters, sorting, and pagination. This is more powerful than the basic entries method as it supports structured queries.
127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/attio/resources/lists.rb', line 127 def query_entries(id_or_slug:, filter: nil, sort: nil, limit: nil, offset: nil) validate_id!(id_or_slug, "List") query_params = build_query_params({ filter: filter, sort: sort, limit: limit, offset: offset, }) request(:post, "lists/#{id_or_slug}/entries/query", query_params) end |
#update(id_or_slug:, 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 list.
Updates the configuration of an existing list. You can modify the name, description, visibility, and other list properties.
96 97 98 99 100 |
# File 'lib/attio/resources/lists.rb', line 96 def update(id_or_slug:, data:) validate_id!(id_or_slug, "List") validate_list_data!(data) request(:patch, "lists/#{id_or_slug}", { data: data }) end |
#update_entry(id_or_slug:, entry_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 list entry.
Updates the data for an existing list entry. This method requires the entry ID and will update only the provided fields, leaving other fields unchanged.
222 223 224 225 226 227 228 229 230 |
# File 'lib/attio/resources/lists.rb', line 222 def update_entry(id_or_slug:, entry_id:, data:) validate_id!(id_or_slug, "List") validate_id!(entry_id, "Entry") validate_list_entry_data!(data) request_body = { data: data } request(:patch, "lists/#{id_or_slug}/entries/#{entry_id}", request_body) end |
#validate_list_data!(data) ⇒ 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.
Validates that the list data parameter is present and valid.
242 243 244 245 |
# File 'lib/attio/resources/lists.rb', line 242 private def validate_list_data!(data) raise ArgumentError, "Data is required" if data.nil? raise ArgumentError, "Data must be a hash" unless data.is_a?(Hash) end |
#validate_list_entry_data!(data) ⇒ 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.
232 233 234 235 |
# File 'lib/attio/resources/lists.rb', line 232 private def validate_list_entry_data!(data) raise ArgumentError, "Data is required" if data.nil? raise ArgumentError, "Data must be a hash" unless data.is_a?(Hash) end |