# HG changeset patch # User Mikael Berthe # Date 1521570031 -3600 # Node ID 642d690de0ba24fad44e9e15adb97028e09699f3 # Parent 3cade8971ed9fc81b7003899158c8899d2821877 GetTimelines: Add parameter 'onlyMedia' (Mastodon 2.3.0+) diff -r 3cade8971ed9 -r 642d690de0ba timelines.go --- a/timelines.go Tue Mar 20 18:55:00 2018 +0100 +++ b/timelines.go Tue Mar 20 19:20:31 2018 +0100 @@ -17,11 +17,12 @@ // or a list (use "!N", e.g. "!42" for list ID #42). // For the public timelines, you can set 'local' to true to get only the // local instance. +// Set 'onlyMedia' to true to only get statuses that have media attachments. // If lopt.All is true, several requests will be made until the API server // has nothing to return. // If lopt.Limit is set (and not All), several queries can be made until the // limit is reached. -func (mc *Client) GetTimelines(timeline string, local bool, lopt *LimitParams) ([]Status, error) { +func (mc *Client) GetTimelines(timeline string, local, onlyMedia bool, lopt *LimitParams) ([]Status, error) { var endPoint string switch { @@ -49,6 +50,9 @@ if timeline == "public" && local { params["local"] = "true" } + if onlyMedia { + params["only_media"] = "true" + } return mc.getMultipleStatuses(endPoint, params, lopt) }