Module: Mastodon::REST::Lists

Includes:
Utils
Included in:
API
Defined in:
lib/mastodon/rest/lists.rb

Instance Method Summary collapse

Methods included from Utils

#array_param, #perform_request, #perform_request_with_collection, #perform_request_with_object

Instance Method Details

#add_accounts_to_list(id, account_ids = []) ⇒ Object

Add accounts to a list


65
66
67
# File 'lib/mastodon/rest/lists.rb', line 65

def add_accounts_to_list(id,  = [])
  perform_request(:post, "/api/v1/lists/#{id}/accounts", { 'account_ids[]':  })
end

#create_list(params = {}) ⇒ Mastodon::List

Create a list

Options Hash (params):

  • :title (Object)

31
32
33
# File 'lib/mastodon/rest/lists.rb', line 31

def create_list(params = {})
  perform_request_with_object(:post, '/api/v1/lists/', params, Mastodon::List)
end

#delete_list(id) ⇒ Object

Delete a list


46
47
48
# File 'lib/mastodon/rest/lists.rb', line 46

def delete_list(id)
  perform_request(:delete, "/api/v1/lists/#{id}")
end

#list(id) ⇒ Mastodon::List

Retrieve a list


23
24
25
# File 'lib/mastodon/rest/lists.rb', line 23

def list(id)
  perform_request_with_object(:get, "/api/v1/lists/#{id}", {}, Mastodon::List)
end

#list_accounts(id, options = {}) ⇒ Mastodon::Collection<Mastodon::Account>

Get a list of accounts on the list

Options Hash (options):

  • :max_id (Integer)
  • :since_id (Integer)
  • :min_id (Integer)
  • :limit (Integer)

58
59
60
# File 'lib/mastodon/rest/lists.rb', line 58

def list_accounts(id, options = {})
  perform_request_with_collection(:get, "/api/v1/lists/#{id}/accounts", options, Mastodon::)
end

#lists(options = {}) ⇒ Mastodon::Collection<Mastodon::List>

Get a list of your lists

Options Hash (options):

  • :max_id (Integer)
  • :since_id (Integer)
  • :limit (Integer)

16
17
18
# File 'lib/mastodon/rest/lists.rb', line 16

def lists(options = {})
  perform_request_with_collection(:get, '/api/v1/lists', options, Mastodon::List)
end

#remove_accounts_from_list(id, account_ids = []) ⇒ Object

Remove accounts from list


72
73
74
# File 'lib/mastodon/rest/lists.rb', line 72

def remove_accounts_from_list(id,  = [])
  perform_request(:delete, "/api/v1/lists/#{id}/accounts", { 'account_ids[]':  })
end

#update_list(id, params = {}) ⇒ Mastodon::List

Update a list

Options Hash (params):

  • :title (Object)

40
41
42
# File 'lib/mastodon/rest/lists.rb', line 40

def update_list(id, params = {})
  perform_request_with_object(:put, "/api/v1/lists/#{id}", params, Mastodon::List)
end