Client for the Gab.com API, documented at developers.gab.com.
This does NOT do authentication. You'll need to use billstclair/elm-oauth-middleware for that. See the example directory.
The requests all come in two flavors, one which has the decoder built in, and returns an Http.Request, and one for which you provide your own decoder, and returns RequestParts. E.g.:
getTorbaRequest : OAuth.Token -> Http.Request User
getTorbaRequest token =
userProfile token "a"
getTorbaParts : OAuth.Token -> RequestParts Json.Decode.Value
getTorbaParts token =
userProfileParts Json.Decode.value token "a"
getTorbaRequestFromParts : OAuth.Token -> Http.Request Json.Decode.Value
getTorbaRequestFromParts token =
getTorbaParts token
|> requestReturn the logged-in user's profile information, using a custom decoder.
Return the logged-in user's profile information as a User record.
Return the logged-in user's profile information, using a custom decoder.
Return the logged-in user's followers as a UserList record.
userFollowers token username beforebefore is the number of following users to skip before the listing starts. This enables scrolling through a long list.
Return the logged-in user's followers, using a custom decoder.
userFollowersParts decoder token username beforebefore is the number of following users to skip before the listing starts. This enables scrolling through a long list.
Return a list of users following the logged-in user, as a UserList record.
userFollowing token username beforebefore is the number of followers to skip before the listing starts. This enables scrolling through a long list.
Return a list of users following the logged-in user, using a custom decoder.
userFollowingParts decoder token username beforebefore is the number of followers to skip before the listing starts. This enables scrolling through a long list.
Follow or unfollow a user. Return value not interesting.
followUser token username unfollowFollow or unfollow a user, with a custom decoder.
followUserParts decoder token username unfollowMute or unmute a user. Return value not interesting.
muteUser token username unmuteThis isn't currently implemented by the API, but I expect that to change.
Mute or unmute a user, with a custom decoder.
muteUserParts decoder token username unmuteThis isn't currently implemented by the API, but I expect that to change.
Return posts in the home feed.
homeFeed token beforeThe posts returned will have dates before before. Pass the empty string for either to not limit that end.
Return posts in the home feed, using a custom encoder.
homeFeedParts decoder token beforeThe posts returned will have dates before before. Pass the empty string for either to not limit that end.
Return posts for a user feed.
userFeed token user beforeThe posts returned will have dates before before. Pass the empty string for either to not limit that end.
Return posts for a user feed, using a custom decoder.
userFeedParts decoder user token beforeThe posts returned will have dates before before. Pass the empty string for either to not limit that end.
Return posts for a group feed.
groupFeed token group beforeThe posts returned will have dates before before. Pass the empty string for either to not limit that end.
This is a guess at what this API command will look like. It doesn't yet exist.
Return posts for a group feed, using a custom decoder.
groupFeedParts decoder group token beforeThe posts returned will have dates before before. Pass the empty string for either to not limit that end.
This is a guess at what this API command will look like. It doesn't yet exist.
Return the posts in the "popular" feed, as a ActivityLogList.
popularFeed tokenReturn the posts in the "popular" feed, using a custom decoder.
popularFeedParts decoder tokenReturn a list of popular users, as a UserList record.
popularUsers tokenReturn a list of popular users, using a custom decoder.
popularUserParts decoder tokenGet a single post.
getPost token postidGet a single post, using a custom decoder.
getPostParts decoder token postidUpvote or unupvote a post. Return value not interesting.
upvotePost token postid unupvoteUpvote or unupvote a post, with a custom decoder.
upvotePostParts decoder token postid unupvoteDownvote or undownvote a post. Return value not interesting.
downvotePost token postid undownvoteDownvote or undownvote a post, with a custom decoder.
downvotePostParts decoder token postid undownvoteRepost or unrepost. Return value not interesting.
repost token postid unrepostRepost or unrepost, with a custom decoder.
repostParts decoder token postid unrepostPosting uses JSON, which is not in the spec, but is what the web client does.
Create a new post with a custom decoder.
Posting an image.
The String that comes back is a media ID, to be used in PostForm.media_attachments.
Post an image with a custom decoder
Shared by doUsersParts and doPostParts
doParts prefix operation decoder token identifier undoprefix can be "users" or "posts".
If undo is True, does a DELETE. Otherwise, does a POST.
Shared by followUserParts and muteUserParts
doUsersParts operation decoder token username undooperation can be "follow" or "mute".
Shared by upvotePostParts, downvotePostParts, repostParts
doPostsParts operation decoder token username undooperation can be "upvote", "downvote" or "repost".
Convert an OAuthMiddleWare.ResponseToken to Gab.Types.SavedToken.
Use Gab.EncodeDecode.savedTokenEncoder and Gab.EncodeDecode.savedTokenDecoder to persist it.
The base URI for GAB API requests. Automatically prepended to path args.
Turn parts into a ready-to-send Http.Request.
Simple HTTP GET request. Empty body, no custom headers.
get token path decoderGeneral-purpose Http.Request constructor.
request method headers token path body decodermethod is the Http method, e.g. "GET".
headers is a list of custom Http.Headers.
token is an OAuth token, often gotten with billstclair/elm-oauth-middleware.
path is the path to the API endpoint, with NO leading slash.
decoder is a JSON decoder for the result.
Debugging function for displaying a request body.
Return the logged-in user's profile information as a User record.