2017-04-26 15:07:43 +00:00
|
|
|
module Mastodon.ApiUrl
|
|
|
|
exposing
|
|
|
|
( apps
|
|
|
|
, oauthAuthorize
|
|
|
|
, oauthToken
|
2017-04-28 09:21:54 +00:00
|
|
|
, userAccount
|
2017-04-26 15:07:43 +00:00
|
|
|
, account
|
2017-04-27 20:01:51 +00:00
|
|
|
, accountTimeline
|
2017-04-29 16:05:06 +00:00
|
|
|
, followers
|
|
|
|
, following
|
2017-04-29 07:20:26 +00:00
|
|
|
, status
|
2017-04-26 15:07:43 +00:00
|
|
|
, homeTimeline
|
|
|
|
, publicTimeline
|
|
|
|
, notifications
|
2017-04-29 20:48:55 +00:00
|
|
|
, relationships
|
2017-04-26 15:07:43 +00:00
|
|
|
, statuses
|
2017-04-27 16:39:14 +00:00
|
|
|
, context
|
2017-04-26 15:07:43 +00:00
|
|
|
, reblog
|
|
|
|
, unreblog
|
|
|
|
, favourite
|
|
|
|
, unfavourite
|
2017-04-29 20:48:55 +00:00
|
|
|
, follow
|
|
|
|
, unfollow
|
2017-04-26 15:07:43 +00:00
|
|
|
, streaming
|
2017-05-01 20:10:34 +00:00
|
|
|
, searchAccount
|
2017-04-26 15:07:43 +00:00
|
|
|
)
|
|
|
|
|
2017-05-01 20:10:34 +00:00
|
|
|
import Mastodon.Encoder exposing (encodeUrl)
|
|
|
|
|
2017-04-26 15:07:43 +00:00
|
|
|
|
|
|
|
type alias Server =
|
|
|
|
String
|
|
|
|
|
|
|
|
|
2017-05-02 20:05:46 +00:00
|
|
|
apps : String
|
|
|
|
apps =
|
|
|
|
"/api/v1/apps"
|
2017-04-26 15:07:43 +00:00
|
|
|
|
|
|
|
|
2017-05-02 20:05:46 +00:00
|
|
|
oauthAuthorize : String
|
|
|
|
oauthAuthorize =
|
|
|
|
"/oauth/authorize"
|
2017-04-26 15:07:43 +00:00
|
|
|
|
|
|
|
|
2017-05-02 20:05:46 +00:00
|
|
|
oauthToken : String
|
|
|
|
oauthToken =
|
|
|
|
"/oauth/token"
|
2017-04-26 15:07:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
accounts : String
|
|
|
|
accounts =
|
|
|
|
"/api/v1/accounts/"
|
|
|
|
|
|
|
|
|
|
|
|
account : Int -> String
|
|
|
|
account id =
|
|
|
|
accounts ++ (toString id)
|
|
|
|
|
|
|
|
|
2017-05-02 20:05:46 +00:00
|
|
|
follow : Int -> String
|
|
|
|
follow id =
|
|
|
|
accounts ++ (toString id) ++ "/follow"
|
2017-04-29 20:48:55 +00:00
|
|
|
|
|
|
|
|
2017-05-02 20:05:46 +00:00
|
|
|
unfollow : Int -> String
|
|
|
|
unfollow id =
|
|
|
|
accounts ++ (toString id) ++ "/unfollow"
|
2017-04-29 20:48:55 +00:00
|
|
|
|
|
|
|
|
2017-05-02 20:05:46 +00:00
|
|
|
userAccount : String
|
|
|
|
userAccount =
|
|
|
|
accounts ++ "verify_credentials"
|
2017-04-28 09:21:54 +00:00
|
|
|
|
|
|
|
|
2017-05-02 20:05:46 +00:00
|
|
|
searchAccount : String
|
|
|
|
searchAccount =
|
|
|
|
accounts ++ "search"
|
2017-05-01 20:10:34 +00:00
|
|
|
|
|
|
|
|
2017-04-29 20:48:55 +00:00
|
|
|
relationships : List Int -> String
|
|
|
|
relationships ids =
|
2017-05-01 20:10:34 +00:00
|
|
|
encodeUrl (accounts ++ "relationships") <|
|
|
|
|
List.map (\id -> ( "id[]", toString id )) ids
|
2017-04-29 20:48:55 +00:00
|
|
|
|
|
|
|
|
2017-04-29 16:05:06 +00:00
|
|
|
followers : Int -> String
|
|
|
|
followers id =
|
|
|
|
(account id) ++ "/followers"
|
|
|
|
|
|
|
|
|
|
|
|
following : Int -> String
|
|
|
|
following id =
|
|
|
|
(account id) ++ "/following"
|
|
|
|
|
|
|
|
|
2017-04-26 15:07:43 +00:00
|
|
|
homeTimeline : String
|
|
|
|
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
|
|
|
|
|
|
|
|
|
2017-04-27 20:01:51 +00:00
|
|
|
accountTimeline : Int -> String
|
|
|
|
accountTimeline id =
|
|
|
|
(account id) ++ "/statuses"
|
|
|
|
|
|
|
|
|
2017-04-26 15:07:43 +00:00
|
|
|
notifications : String
|
|
|
|
notifications =
|
|
|
|
"/api/v1/notifications"
|
|
|
|
|
|
|
|
|
2017-05-02 20:05:46 +00:00
|
|
|
statuses : String
|
|
|
|
statuses =
|
|
|
|
"/api/v1/statuses"
|
2017-04-26 15:07:43 +00:00
|
|
|
|
|
|
|
|
2017-05-02 20:05:46 +00:00
|
|
|
context : Int -> String
|
|
|
|
context id =
|
|
|
|
statuses ++ "/" ++ (toString id) ++ "/context"
|
2017-04-27 16:39:14 +00:00
|
|
|
|
|
|
|
|
2017-05-02 20:05:46 +00:00
|
|
|
reblog : Int -> String
|
|
|
|
reblog id =
|
|
|
|
statuses ++ "/" ++ (toString id) ++ "/reblog"
|
2017-04-26 15:07:43 +00:00
|
|
|
|
|
|
|
|
2017-05-02 20:05:46 +00:00
|
|
|
status : Int -> String
|
|
|
|
status id =
|
|
|
|
statuses ++ "/" ++ (toString id)
|
2017-04-29 07:20:26 +00:00
|
|
|
|
|
|
|
|
2017-05-02 20:05:46 +00:00
|
|
|
unreblog : Int -> String
|
|
|
|
unreblog id =
|
|
|
|
statuses ++ "/" ++ (toString id) ++ "/unreblog"
|
2017-04-26 15:07:43 +00:00
|
|
|
|
|
|
|
|
2017-05-02 20:05:46 +00:00
|
|
|
favourite : Int -> String
|
|
|
|
favourite id =
|
|
|
|
statuses ++ "/" ++ (toString id) ++ "/favourite"
|
2017-04-26 15:07:43 +00:00
|
|
|
|
|
|
|
|
2017-05-02 20:05:46 +00:00
|
|
|
unfavourite : Int -> String
|
|
|
|
unfavourite id =
|
|
|
|
statuses ++ "/" ++ (toString id) ++ "/unfavourite"
|
2017-04-26 15:07:43 +00:00
|
|
|
|
|
|
|
|
2017-05-02 20:05:46 +00:00
|
|
|
streaming : String
|
|
|
|
streaming =
|
|
|
|
"/api/v1/streaming/"
|