mastodon-api 1.1.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/mastodon.rb +2 -0
- data/lib/mastodon/access_token.rb +21 -0
- data/lib/mastodon/account.rb +44 -2
- data/lib/mastodon/app.rb +8 -1
- data/lib/mastodon/card.rb +41 -0
- data/lib/mastodon/client.rb +8 -1
- data/lib/mastodon/conversation.rb +25 -0
- data/lib/mastodon/emoji.rb +21 -0
- data/lib/mastodon/entities/app.rb +12 -0
- data/lib/mastodon/entities/hashtag.rb +12 -0
- data/lib/mastodon/entities/media.rb +13 -1
- data/lib/mastodon/entities/mention.rb +1 -1
- data/lib/mastodon/field.rb +18 -0
- data/lib/mastodon/filter.rb +29 -0
- data/lib/mastodon/hashtag.rb +19 -0
- data/lib/mastodon/instance.rb +33 -0
- data/lib/mastodon/list.rb +15 -0
- data/lib/mastodon/media.rb +16 -2
- data/lib/mastodon/notification.rb +30 -0
- data/lib/mastodon/relationship.rb +23 -2
- data/lib/mastodon/rest/accounts.rb +52 -9
- data/lib/mastodon/rest/api.rb +24 -0
- data/lib/mastodon/rest/apps.rb +7 -0
- data/lib/mastodon/rest/conversations.rb +34 -0
- data/lib/mastodon/rest/custom_emojis.rb +16 -0
- data/lib/mastodon/rest/domain_blocks.rb +32 -0
- data/lib/mastodon/rest/endorsements.rb +36 -0
- data/lib/mastodon/rest/filters.rb +61 -0
- data/lib/mastodon/rest/instances.rb +28 -0
- data/lib/mastodon/rest/lists.rb +77 -0
- data/lib/mastodon/rest/media.rb +17 -3
- data/lib/mastodon/rest/notifications.rb +34 -0
- data/lib/mastodon/rest/relationships.rb +68 -1
- data/lib/mastodon/rest/reports.rb +20 -0
- data/lib/mastodon/rest/request.rb +7 -3
- data/lib/mastodon/rest/scheduled_statuses.rb +43 -0
- data/lib/mastodon/rest/search.rb +20 -0
- data/lib/mastodon/rest/statuses.rb +57 -5
- data/lib/mastodon/rest/suggestions.rb +13 -2
- data/lib/mastodon/rest/timelines.rb +19 -0
- data/lib/mastodon/rest/utils.rb +3 -3
- data/lib/mastodon/results.rb +18 -0
- data/lib/mastodon/scheduled_status.rb +25 -0
- data/lib/mastodon/status.rb +49 -4
- data/lib/mastodon/streaming/client.rb +96 -0
- data/lib/mastodon/streaming/connection.rb +44 -0
- data/lib/mastodon/streaming/events/filters_change.rb +7 -0
- data/lib/mastodon/streaming/events/status_delete.rb +16 -0
- data/lib/mastodon/streaming/message_parser.rb +23 -0
- data/lib/mastodon/streaming/response.rb +42 -0
- data/lib/mastodon/version.rb +2 -2
- data/mastodon.gemspec +5 -3
- metadata +68 -9
data/lib/mastodon/rest/media.rb
CHANGED
@@ -7,10 +7,24 @@ module Mastodon
|
|
7
7
|
include Mastodon::REST::Utils
|
8
8
|
|
9
9
|
# Upload a media file
|
10
|
-
# @param file [HTTP::FormData::File]
|
10
|
+
# @param file [File, StringIO, HTTP::FormData::File]
|
11
|
+
# @param params [Hash]
|
12
|
+
# @option params :description [String] Alternative text
|
13
|
+
# @option params :focus [String] Two floating points, comma-delimited
|
11
14
|
# @return [Mastodon::Media]
|
12
|
-
def upload_media(file)
|
13
|
-
|
15
|
+
def upload_media(file, params = {})
|
16
|
+
file = file.is_a?(HTTP::FormData::File) ? file : HTTP::FormData::File.new(file)
|
17
|
+
perform_request_with_object(:post, '/api/v1/media', { file: file }.merge(params), Mastodon::Media)
|
18
|
+
end
|
19
|
+
|
20
|
+
# Update a media description, can only be updated while it's not associated to a status
|
21
|
+
# @param id [Integer]
|
22
|
+
# @param params [Hash]
|
23
|
+
# @option params :description [String] Alternative text
|
24
|
+
# @option params :focus [String] Two floating points, comma-delimited
|
25
|
+
# @return [Mastodon::Media]
|
26
|
+
def update_media(id, params)
|
27
|
+
perform_request_with_object(:put, "/api/v1/media/#{media_id}", params, Mastodon::Media)
|
14
28
|
end
|
15
29
|
end
|
16
30
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'mastodon/rest/utils'
|
2
|
+
require 'mastodon/notification'
|
3
|
+
|
4
|
+
module Mastodon
|
5
|
+
module REST
|
6
|
+
module Notifications
|
7
|
+
include Mastodon::REST::Utils
|
8
|
+
|
9
|
+
# Get a list of notifications for the authenticated user
|
10
|
+
# @param options [Hash]
|
11
|
+
# @option options :max_id [Integer]
|
12
|
+
# @option options :since_id [Integer]
|
13
|
+
# @option options :min_id [Integer]
|
14
|
+
# @option options :limit [Integer]
|
15
|
+
# @option options :exclude_types [Array<String>]
|
16
|
+
# @return [Mastodon::Collection<Mastodon::Notification>]
|
17
|
+
def notifications(options = {})
|
18
|
+
options[:'exclude_types[]'] = options.delete(:exclude_types) if options.key?(:exclude_types)
|
19
|
+
perform_request_with_collection(:get, '/api/v1/notifications', options, Mastodon::Notification)
|
20
|
+
end
|
21
|
+
|
22
|
+
# Dismiss a notification
|
23
|
+
# @param id [Integer]
|
24
|
+
def dismiss_notification(id)
|
25
|
+
perform_request(:post, "/api/v1/notifications/#{id}/dismiss")
|
26
|
+
end
|
27
|
+
|
28
|
+
# Clear all notifications
|
29
|
+
def clear_notifications
|
30
|
+
perform_request(:post, '/api/v1/notifications/clear')
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'mastodon/rest/utils'
|
2
2
|
require 'mastodon/relationship'
|
3
|
+
require 'mastodon/status'
|
3
4
|
|
4
5
|
module Mastodon
|
5
6
|
module REST
|
@@ -10,7 +11,30 @@ module Mastodon
|
|
10
11
|
# @param ids [Integer]
|
11
12
|
# @return [Mastodon::Collection<Mastodon::Relationship>]
|
12
13
|
def relationships(*ids)
|
13
|
-
perform_request_with_collection(:get, '/api/v1/accounts/relationships',
|
14
|
+
perform_request_with_collection(:get, '/api/v1/accounts/relationships', { 'id[]': ids }, Mastodon::Relationship)
|
15
|
+
end
|
16
|
+
|
17
|
+
# Get a list of pending follow requests
|
18
|
+
# @param options [Hash]
|
19
|
+
# @option options :max_id [Integer]
|
20
|
+
# @option options :since_id [Integer]
|
21
|
+
# @option options :min_id [Integer]
|
22
|
+
# @option options :limit [Integer]
|
23
|
+
# @return [Mastodon::Collection<Mastodon::Account>]
|
24
|
+
def follow_requests(options = {})
|
25
|
+
perform_request_with_collection(:get, '/api/v1/follow_requests', options, Mastodon::Account)
|
26
|
+
end
|
27
|
+
|
28
|
+
# Authorize a follow request
|
29
|
+
# @param id [Integer]
|
30
|
+
def authorize_follow_request(id)
|
31
|
+
perform_request(:post, "/api/v1/follow_requests/#{id}/authorize")
|
32
|
+
end
|
33
|
+
|
34
|
+
# Reject a follow request
|
35
|
+
# @param id [Integer]
|
36
|
+
def reject_follow_request(id)
|
37
|
+
perform_request(:post, "/api/v1/follow_requests/#{id}/reject")
|
14
38
|
end
|
15
39
|
|
16
40
|
# Follow a user
|
@@ -20,6 +44,13 @@ module Mastodon
|
|
20
44
|
perform_request_with_object(:post, "/api/v1/accounts/#{id}/follow", {}, Mastodon::Relationship)
|
21
45
|
end
|
22
46
|
|
47
|
+
# Follow a remote user
|
48
|
+
# @param uri [String] username@domain of the person you want to follow
|
49
|
+
# @return [Mastodon::Account]
|
50
|
+
def remote_follow(uri)
|
51
|
+
perform_request_with_object(:post, '/api/v1/follows', { uri: uri }, Mastodon::Account)
|
52
|
+
end
|
53
|
+
|
23
54
|
# Unfollow a user
|
24
55
|
# @param id [Integer]
|
25
56
|
# @return [Mastodon::Relationship]
|
@@ -27,6 +58,17 @@ module Mastodon
|
|
27
58
|
perform_request_with_object(:post, "/api/v1/accounts/#{id}/unfollow", {}, Mastodon::Relationship)
|
28
59
|
end
|
29
60
|
|
61
|
+
# Get a list of blocked accounts
|
62
|
+
# @param options [Hash]
|
63
|
+
# @option options :max_id [Integer]
|
64
|
+
# @option options :since_id [Integer]
|
65
|
+
# @option options :min_id [Integer]
|
66
|
+
# @option options :limit [Integer]
|
67
|
+
# @return [Mastodon::Collection<Mastodon::Account>]
|
68
|
+
def blocks(options = {})
|
69
|
+
perform_request_with_collection(:get, '/api/v1/blocks', options, Mastodon::Account)
|
70
|
+
end
|
71
|
+
|
30
72
|
# Block a user
|
31
73
|
# @param id [Integer]
|
32
74
|
# @return [Mastodon::Relationship]
|
@@ -41,6 +83,17 @@ module Mastodon
|
|
41
83
|
perform_request_with_object(:post, "/api/v1/accounts/#{id}/unblock", {}, Mastodon::Relationship)
|
42
84
|
end
|
43
85
|
|
86
|
+
# Get a list of muted accounts
|
87
|
+
# @param options [Hash]
|
88
|
+
# @option options :max_id [Integer]
|
89
|
+
# @option options :since_id [Integer]
|
90
|
+
# @option options :min_id [Integer]
|
91
|
+
# @option options :limit [Integer]
|
92
|
+
# @return [Mastodon::Collection<Mastodon::Account>]
|
93
|
+
def mutes(options = {})
|
94
|
+
perform_request_with_collection(:get, '/api/v1/mutes', options, Mastodon::Account)
|
95
|
+
end
|
96
|
+
|
44
97
|
# Mute a user
|
45
98
|
# @param id [Integer]
|
46
99
|
# @return [Mastodon::Relationship]
|
@@ -54,6 +107,20 @@ module Mastodon
|
|
54
107
|
def unmute(id)
|
55
108
|
perform_request_with_object(:post, "/api/v1/accounts/#{id}/unmute", {}, Mastodon::Relationship)
|
56
109
|
end
|
110
|
+
|
111
|
+
# Mute notifications for a status
|
112
|
+
# @param id [Integer]
|
113
|
+
# @return [Mastodon::Status]
|
114
|
+
def mute_status(id)
|
115
|
+
perform_request_with_object(:post, "/api/v1/statuses/#{id}/mute", {}, Mastodon::Status)
|
116
|
+
end
|
117
|
+
|
118
|
+
# Unmute notifications for a status
|
119
|
+
# @param id [Integer]
|
120
|
+
# @return [Mastodon::Status]
|
121
|
+
def unmute_status(id)
|
122
|
+
perform_request_with_object(:post, "/api/v1/statuses/#{id}/unmute", {}, Mastodon::Status)
|
123
|
+
end
|
57
124
|
end
|
58
125
|
end
|
59
126
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'mastodon/rest/utils'
|
2
|
+
|
3
|
+
module Mastodon
|
4
|
+
module REST
|
5
|
+
module Reports
|
6
|
+
include Mastodon::REST::Utils
|
7
|
+
|
8
|
+
# Create a report
|
9
|
+
# @param account_id [Integer]
|
10
|
+
# @param params [Hash]
|
11
|
+
# @option params :status_ids [Array<Integer>] Statuses to be included in the report
|
12
|
+
# @option params :comment [String] Description of the report
|
13
|
+
# @option params :forward [Boolean] Whether to forward a copy of the report to the origin of the account
|
14
|
+
def create_report(account_id, params = {})
|
15
|
+
params[:'status_ids[]'] = params.delete(:status_ids) if params.key?(:status_ids)
|
16
|
+
perform_request(:post, '/api/v1/reports', { account_id: account_id }.merge(params))
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'addressable/uri'
|
2
2
|
require 'http'
|
3
|
-
require '
|
3
|
+
require 'oj'
|
4
4
|
require 'mastodon/error'
|
5
5
|
require 'mastodon/headers'
|
6
6
|
|
@@ -14,12 +14,16 @@ module Mastodon
|
|
14
14
|
@headers = Mastodon::Headers.new(@client).request_headers
|
15
15
|
@path = @uri.path
|
16
16
|
@options = options
|
17
|
+
@headers = @options.delete(:headers).merge @headers if @options.is_a?(Hash) && @options[:headers]
|
17
18
|
end
|
18
19
|
|
19
20
|
def perform
|
20
21
|
options_key = @request_method == :get ? :params : :form
|
21
22
|
response = http_client.headers(@headers).public_send(@request_method, @uri.to_s, options_key => @options)
|
22
|
-
|
23
|
+
|
24
|
+
STDERR.puts response.body if ENV['DEBUG'] == 'true'
|
25
|
+
|
26
|
+
fail_or_return(response.code, response.body.empty? ? '' : Oj.load(response.to_s, mode: :null))
|
23
27
|
end
|
24
28
|
|
25
29
|
private
|
@@ -30,7 +34,7 @@ module Mastodon
|
|
30
34
|
end
|
31
35
|
|
32
36
|
def http_client
|
33
|
-
HTTP
|
37
|
+
HTTP.timeout(:per_operation, connect: @client.timeout[:connect], read: @client.timeout[:read], write: @client.timeout[:write])
|
34
38
|
end
|
35
39
|
end
|
36
40
|
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'mastodon/rest/utils'
|
2
|
+
require 'mastodon/scheduled_status'
|
3
|
+
|
4
|
+
module Mastodon
|
5
|
+
module REST
|
6
|
+
module ScheduledStatuses
|
7
|
+
include Mastodon::REST::Utils
|
8
|
+
|
9
|
+
# Get a list of scheduled statuses
|
10
|
+
# @param options [Hash]
|
11
|
+
# @option options :max_id [Integer]
|
12
|
+
# @option options :since_id [Integer]
|
13
|
+
# @option options :min_id [Integer]
|
14
|
+
# @option options :limit [Integer]
|
15
|
+
# @return [Mastodon::Collection<Mastodon::ScheduledStatus>]
|
16
|
+
def scheduled_statuses(options = {})
|
17
|
+
perform_request_with_collection(:get, '/api/v1/scheduled_statuses', options, Mastodon::ScheduledStatus)
|
18
|
+
end
|
19
|
+
|
20
|
+
# Retrieve a scheduled status
|
21
|
+
# @param id [Integer]
|
22
|
+
# @return [Mastodon::ScheduledStatus]
|
23
|
+
def scheduled_status(id)
|
24
|
+
perform_request_with_object(:get, "/api/v1/scheduled_statuses/#{id}", {}, Mastodon::ScheduledStatus)
|
25
|
+
end
|
26
|
+
|
27
|
+
# Update a scheduled status
|
28
|
+
# @param id [Integer]
|
29
|
+
# @param params [Hash]
|
30
|
+
# @option params :scheduled_at [String]
|
31
|
+
# @return [Mastodon::ScheduledStatus]
|
32
|
+
def update_scheduled_status(id, params = {})
|
33
|
+
perform_request_with_object(:put, "/api/v1/scheduled_statuses/#{id}", params, Mastodon::ScheduledStatus)
|
34
|
+
end
|
35
|
+
|
36
|
+
# Cancel a scheduled status
|
37
|
+
# @param id [Integer]
|
38
|
+
def delete_scheduled_status(id)
|
39
|
+
perform_request(:delete, "/api/v1/scheduled_statuses/#{id}")
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'mastodon/rest/utils'
|
2
|
+
require 'mastodon/status'
|
3
|
+
|
4
|
+
module Mastodon
|
5
|
+
module REST
|
6
|
+
module Search
|
7
|
+
include Mastodon::REST::Utils
|
8
|
+
|
9
|
+
# Search for content
|
10
|
+
# @param options [Hash]
|
11
|
+
# @option options :q [String] The search query
|
12
|
+
# @option options :resolve [Boolean] Whether to resolve non-local accounts
|
13
|
+
# @option options :limit [Integer]
|
14
|
+
# @return [Mastodon::Results]
|
15
|
+
def search(query, options = {})
|
16
|
+
perform_request_with_object(:get, '/api/v2/search', { q: query }.merge(options), Mastodon::Results)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -8,11 +8,20 @@ module Mastodon
|
|
8
8
|
|
9
9
|
# Create new status
|
10
10
|
# @param text [String]
|
11
|
-
# @param
|
12
|
-
# @
|
13
|
-
# @
|
14
|
-
|
15
|
-
|
11
|
+
# @param params [Hash]
|
12
|
+
# @option params :in_reply_to_id [Integer]
|
13
|
+
# @option params :media_ids [Array<Integer>]
|
14
|
+
# @option params :visibility [String]
|
15
|
+
# @option params :language [String]
|
16
|
+
# @option params :sensitive [Boolean]
|
17
|
+
# @option params :spoiler_text [String]
|
18
|
+
# @option params :scheduled_at [String]
|
19
|
+
# @return <Mastodon::Status>
|
20
|
+
def create_status(text, params = {})
|
21
|
+
params[:status] = text
|
22
|
+
params[:'media_ids[]'] = params.delete(:media_ids) if params.key?(:media_ids)
|
23
|
+
|
24
|
+
perform_request_with_object(:post, '/api/v1/statuses', params, Mastodon::Status)
|
16
25
|
end
|
17
26
|
|
18
27
|
# Retrieve status
|
@@ -57,12 +66,55 @@ module Mastodon
|
|
57
66
|
perform_request_with_object(:post, "/api/v1/statuses/#{id}/unfavourite", {}, Mastodon::Status)
|
58
67
|
end
|
59
68
|
|
69
|
+
# Get a list of accounts that reblogged a toot
|
70
|
+
# @param id [Integer]
|
71
|
+
# @param options [Hash]
|
72
|
+
# @option options :max_id [Integer]
|
73
|
+
# @option options :since_id [Integer]
|
74
|
+
# @option options :min_id [Integer]
|
75
|
+
# @option options :limit [Integer]
|
76
|
+
# @return [Mastodon::Collection<Mastodon::Account>]
|
77
|
+
def reblogged_by(id, options = {})
|
78
|
+
perform_request_with_collection(:get, "/api/v1/statuses/#{id}/reblogged_by", options, Mastodon::Account)
|
79
|
+
end
|
80
|
+
|
81
|
+
# Get a list of accounts that favourited a toot
|
82
|
+
# @param id [Integer]
|
83
|
+
# @param options [Hash]
|
84
|
+
# @option options :max_id [Integer]
|
85
|
+
# @option options :since_id [Integer]
|
86
|
+
# @option options :min_id [Integer]
|
87
|
+
# @option options :limit [Integer]
|
88
|
+
# @return [Mastodon::Collection<Mastodon::Account>]
|
89
|
+
def favourited_by(id, options = {})
|
90
|
+
perform_request_with_collection(:get, "/api/v1/statuses/#{id}/favourited_by", options, Mastodon::Account)
|
91
|
+
end
|
92
|
+
|
93
|
+
# Pin status on own profile
|
94
|
+
# @param id [Integer]
|
95
|
+
# @return [Mastodon::Status]
|
96
|
+
def pin(id)
|
97
|
+
perform_request_with_object(:post, "/api/v1/statuses/#{id}/pin", {}, Mastodon::Status)
|
98
|
+
end
|
99
|
+
|
100
|
+
# Unpin status from own profile
|
101
|
+
# @param id [Integer]
|
102
|
+
# @return [Mastodon::Status]
|
103
|
+
def unpin(id)
|
104
|
+
perform_request_with_object(:post, "/api/v1/statuses/#{id}/unpin", {}, Mastodon::Status)
|
105
|
+
end
|
106
|
+
|
60
107
|
# Get a list of statuses by a user
|
61
108
|
# @param account_id [Integer]
|
62
109
|
# @param options [Hash]
|
63
110
|
# @option options :max_id [Integer]
|
64
111
|
# @option options :since_id [Integer]
|
112
|
+
# @option options :min_id [Integer]
|
65
113
|
# @option options :limit [Integer]
|
114
|
+
# @option options :only_media [Boolean]
|
115
|
+
# @option options :pinned [Boolean]
|
116
|
+
# @option options :exclude_replies [Boolean]
|
117
|
+
# @option options :exclude_reblogs [Boolean]
|
66
118
|
# @return [Mastodon::Collection<Mastodon::Status>]
|
67
119
|
def statuses(account_id, options = {})
|
68
120
|
perform_request_with_collection(:get, "/api/v1/accounts/#{account_id}/statuses", options, Mastodon::Status)
|
@@ -7,9 +7,20 @@ module Mastodon
|
|
7
7
|
include Mastodon::REST::Utils
|
8
8
|
|
9
9
|
# Get "who to follow" suggestions for authenticated user
|
10
|
+
# @param options [Hash]
|
11
|
+
# @option options :max_id [Integer]
|
12
|
+
# @option options :since_id [Integer]
|
13
|
+
# @option options :min_id [Boolean]
|
14
|
+
# @option options :limit [Integer]
|
10
15
|
# @return [Mastodon::Collection<Mastodon::Account>]
|
11
|
-
def suggestions
|
12
|
-
perform_request_with_collection(:get, '/api/v1/
|
16
|
+
def suggestions(options = {})
|
17
|
+
perform_request_with_collection(:get, '/api/v1/suggestions', options, Mastodon::Account)
|
18
|
+
end
|
19
|
+
|
20
|
+
# Remove a suggestion
|
21
|
+
# @param account_id [Integer]
|
22
|
+
def delete_suggestion(account_id)
|
23
|
+
perform_request(:delete, "/api/v1/suggestions/#{account_id}")
|
13
24
|
end
|
14
25
|
end
|
15
26
|
end
|
@@ -10,6 +10,7 @@ module Mastodon
|
|
10
10
|
# @param options [Hash]
|
11
11
|
# @option options :max_id [Integer]
|
12
12
|
# @option options :since_id [Integer]
|
13
|
+
# @option options :min_id [Integer]
|
13
14
|
# @option options :limit [Integer]
|
14
15
|
# @return [Mastodon::Collection<Mastodon::Status>]
|
15
16
|
def home_timeline(options = {})
|
@@ -20,7 +21,10 @@ module Mastodon
|
|
20
21
|
# @param options [Hash]
|
21
22
|
# @option options :max_id [Integer]
|
22
23
|
# @option options :since_id [Integer]
|
24
|
+
# @option options :min_id [Integer]
|
23
25
|
# @option options :limit [Integer]
|
26
|
+
# @option options :local [Boolean]
|
27
|
+
# @option options :only_media [Boolean]
|
24
28
|
# @return [Mastodon::Collection<Mastodon::Status>]
|
25
29
|
def public_timeline(options = {})
|
26
30
|
perform_request_with_collection(:get, '/api/v1/timelines/public', options, Mastodon::Status)
|
@@ -31,11 +35,26 @@ module Mastodon
|
|
31
35
|
# @param options [Hash]
|
32
36
|
# @option options :max_id [Integer]
|
33
37
|
# @option options :since_id [Integer]
|
38
|
+
# @option options :min_id [Integer]
|
34
39
|
# @option options :limit [Integer]
|
40
|
+
# @option options :local [Boolean]
|
41
|
+
# @option options :only_media [Boolean]
|
35
42
|
# @return [Mastodon::Collection<Mastodon::Status>]
|
36
43
|
def hashtag_timeline(hashtag, options = {})
|
37
44
|
perform_request_with_collection(:get, "/api/v1/timelines/tag/#{hashtag}", options, Mastodon::Status)
|
38
45
|
end
|
46
|
+
|
47
|
+
# Retrieve statuses from a list
|
48
|
+
# @param id [String]
|
49
|
+
# @param options [Hash]
|
50
|
+
# @option options :max_id [Integer]
|
51
|
+
# @option options :since_id [Integer]
|
52
|
+
# @option options :min_id [Integer]
|
53
|
+
# @option options :limit [Integer]
|
54
|
+
# @return [Mastodon::Collection<Mastodon::Status>]
|
55
|
+
def list_timeline(id, options = {})
|
56
|
+
perform_request_with_collection(:get, "/api/v1/timelines/list/#{id}", options, Mastodon::Status)
|
57
|
+
end
|
39
58
|
end
|
40
59
|
end
|
41
60
|
end
|
data/lib/mastodon/rest/utils.rb
CHANGED
@@ -28,12 +28,12 @@ module Mastodon
|
|
28
28
|
Mastodon::Collection.new(response, klass)
|
29
29
|
end
|
30
30
|
|
31
|
-
# Format an array of values into a query param
|
31
|
+
# Format an array of values into a query param
|
32
32
|
# @param key [Symbol]
|
33
33
|
# @param values [Enumerable]
|
34
|
-
# @return [
|
34
|
+
# @return [Array]
|
35
35
|
def array_param(key, values)
|
36
|
-
values.map.with_index { |value, i| ["#{key}[
|
36
|
+
values.map.with_index { |value, i| ["#{key}[]", value] }
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|