diff --git a/src/Mastodon/ApiUrl.elm b/src/Mastodon/ApiUrl.elm index 2f57955..ffa68d3 100644 --- a/src/Mastodon/ApiUrl.elm +++ b/src/Mastodon/ApiUrl.elm @@ -25,8 +25,6 @@ module Mastodon.ApiUrl , searchAccount ) -import Mastodon.Encoder exposing (encodeUrl) - type alias Server = String @@ -77,10 +75,9 @@ searchAccount = accounts ++ "search" -relationships : List Int -> String -relationships ids = - encodeUrl (accounts ++ "relationships") <| - List.map (\id -> ( "id[]", toString id )) ids +relationships : String +relationships = + accounts ++ "relationships" followers : Int -> String @@ -98,18 +95,9 @@ homeTimeline = "/api/v1/timelines/home" -publicTimeline : Maybe String -> String -publicTimeline local = - let - isLocal = - case local of - Just local -> - "?local=true" - - Nothing -> - "" - in - "/api/v1/timelines/public" ++ isLocal +publicTimeline : String +publicTimeline = + "/api/v1/timelines/public" accountTimeline : Int -> String diff --git a/src/Mastodon/Http.elm b/src/Mastodon/Http.elm index 4418a17..a97cd13 100644 --- a/src/Mastodon/Http.elm +++ b/src/Mastodon/Http.elm @@ -140,20 +140,19 @@ fetchUserTimeline client = fetchRelationships : Client -> List Int -> Request (List Relationship) fetchRelationships client ids = - -- TODO: use withQueryParams - fetch client GET (ApiUrl.relationships ids) <| Decode.list relationshipDecoder + fetch client GET ApiUrl.relationships (Decode.list relationshipDecoder) + |> Build.withQueryParams (List.map (\id -> ( "id[]", toString id )) ids) fetchLocalTimeline : Client -> Request (List Status) fetchLocalTimeline client = - -- TODO: use withQueryParams - fetch client GET (ApiUrl.publicTimeline (Just "public")) <| Decode.list statusDecoder + fetch client GET ApiUrl.publicTimeline (Decode.list statusDecoder) + |> Build.withQueryParams [ ( "local", "true" ) ] fetchGlobalTimeline : Client -> Request (List Status) fetchGlobalTimeline client = - -- TODO: use withQueryParams - fetch client GET (ApiUrl.publicTimeline (Nothing)) <| Decode.list statusDecoder + fetch client GET ApiUrl.publicTimeline <| Decode.list statusDecoder fetchAccountTimeline : Client -> Int -> Request (List Status)