module Mastodon::REST::Lists

Public Instance Methods

account_lists(id) click to toggle source

Gets the lists this account is a part of @param id [Integer] @return [Mastodon::Collection<Mastodon::List>]

# File lib/mastodon/rest/lists.rb, line 59
def account_lists(id)
  perform_request_with_collection(:get, "/api/v1/accounts/#{id}/lists",
                                  {}, Mastodon::List)
end
create_list(title) click to toggle source

Create a new list @param title [String] @return [Mastodon::List]

# File lib/mastodon/rest/lists.rb, line 30
def create_list(title)
  options = { title: title }
  perform_request_with_object(:post, '/api/v1/lists',
                              options, Mastodon::List)
end
delete_list(id) click to toggle source

Delete a list @param id [Integer] @return [Boolean]

# File lib/mastodon/rest/lists.rb, line 67
def delete_list(id)
  !perform_request(:delete, "/api/v1/lists/#{id}").nil?
end
list(id) click to toggle source

Retrieve list @param id [Integer] @return [Mastodon::List]

# File lib/mastodon/rest/lists.rb, line 14
def list(id)
  perform_request_with_object(:get, "/api/v1/lists/#{id}",
                              {}, Mastodon::List)
end
list_accounts(id, options = {}) click to toggle source

Gets the accounts that are in a list @param id [Integer] @param options [Hash] @option options :limit [Integer] @return [Mastodon::Collection<Mastodon::Account>]

# File lib/mastodon/rest/lists.rb, line 51
def list_accounts(id, options = {})
  perform_request_with_collection(:get, "/api/v1/lists/#{id}/accounts",
                                  options, Mastodon::List)
end
list_add_accounts(id, *accounts) click to toggle source
Add accounts to a list

@param id [Integer] @param accounts [Array<Integer>]

# File lib/mastodon/rest/lists.rb, line 74
def list_add_accounts(id, *accounts)
  options = {}
  options['account_ids[]'] = accounts
  perform_request(:post, "/api/v1/lists/#{id}/accounts",
                  options)
end
list_remove_accounts(id, *accounts) click to toggle source
Add accounts to a list

@param id [Integer] @param accounts [Array<Integer>]

# File lib/mastodon/rest/lists.rb, line 84
def list_remove_accounts(id, *accounts)
  options = {}
  options['account_ids[]'] = accounts
  perform_request(:delete, "/api/v1/lists/#{id}/accounts",
                  options)
end
lists() click to toggle source

Retrieve all lists @param id [Integer] @return [Mastodon::Collections<Mastodon::List>]

# File lib/mastodon/rest/lists.rb, line 22
def lists
  perform_request_with_collection(:get, '/api/v1/lists',
                                  {}, Mastodon::List)
end
update_list(id, options = {}) click to toggle source

Update a list @param id [Integer] @param options [Hash] @option options :title [String] @return [Mastodon::List]

# File lib/mastodon/rest/lists.rb, line 41
def update_list(id, options = {})
  perform_request_with_object(:put, "/api/v1/lists/#{id}",
                              options, Mastodon::List)
end