leverage HttpBuilder.withQueryParams where applicable.
This commit is contained in:
parent
ce27e30297
commit
dc5ad2e670
@ -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
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user