melon-love/elm-gab-api/3.0.1

NOTE: the latest version is 11.0.0

Gab.Types

Shared Types for the Gab API.

Http Requests

type alias RequestParts a =
{ method : String
, headers : List Header
, url : String
, body : HttpBody
, expect : Expect a
, timeout : Maybe Float
, withCredentials : Bool
}

Names the argument to Http.request.

= EmptyBody
| JsonBody Value
| StringBody String String
| OtherBody Body

A custom type for request bodies.

Http Results

type alias PostResult =
{ state : PostResultState
, message : String
}

Returned from the Post and Delete actions

= UnknownState
| SuccessState

The value of PostResult.state for a successful operation.

Users

type alias User =
{ id : Int
, name : String
, username : String
, picture_url : String
, verified : Bool
, is_pro : Bool
, is_donor : Bool
, is_investor : Bool
, is_premium : Bool
, is_private : Bool
, is_tippable : Bool
, is_accessible : Bool
, created_at_month_label : Maybe String
, follower_count : Maybe Int
, following_count : Maybe Int
, post_count : Maybe Int
, picture_url_full : Maybe String
, following : Bool
, followed : Bool
, premium_price : Maybe Float
, follow_pending : Bool
, unread_notification_count : Maybe Int
, stream : Bool
, bio : Maybe String
, cover_url : Maybe String
, show_replies : Bool
, sound_alerts : Bool
, email : Maybe String
, notify_followers : Bool
, notify_mentions : Bool
, notify_likes : Bool
, notify_reposts : Bool
, broadcast_channel : Maybe String
, exclusive_features : Bool
, social_facebook : Bool
, social_twitter : Bool
, is_pro_overdue : Bool
, pro_expires_at : Maybe String
, has_chat : Bool
, has_chat_unread : Bool
, germany_law : Bool
, language : Maybe String
, pinned_post_id : Maybe String
, nsfw_filter : Bool
, hide_premium_content : Bool
, score : Maybe Int
, video_count : Maybe Int
, is_favorited : Bool
, subscribing : Bool
, is_muted : Bool
, can_downvote : Bool
}

Details of a Gab user.

type alias UserList =
{ data : List User
, no_more : Bool
}

A list of User records.

Activity Logs

type alias ActivityLog =
{ id : String
, published_at : String
, type_ : String
, actuser : User
, post : Post
}

One element of the list returned from the feed reading functions.

type alias ActivityLogList =
{ data : List ActivityLog
, no_more : Bool
}

A list of ActivityLog instances.

Notifications

= LikeNotification
| RepostNotification
| FollowNotification
| MentionNotification
| UnknownNotification String

The type of a notification.

type alias NotificationsLog =
{ data : List Notification
, no_more : Bool
}

The result from Gab.notifications

type alias Notification =
{ id : String
, created_at : String
, url : String
, type_ : NotificationType
, message : String
, read : Bool
, post : Maybe Post
, actuser : User
}

A single notification.

Posts

type alias Post =
{ id : Int
, created_at : String
, revised_at : Maybe String
, edited : Bool
, body : String
, body_html : Maybe String
, body_html_summary : Maybe String
, body_html_summary_truncated : Bool
, only_emoji : Bool
, liked : Bool
, disliked : Bool
, bookmarked : Bool
, repost : Bool
, reported : Bool
, score : Int
, like_count : Int
, dislike_count : Int
, reply_count : Int
, repost_count : Int
, is_quote : Bool
, is_reply : Bool
, is_replies_disabled : Bool
, embed : Maybe Embed
, attachment : Attachment
, category : Maybe Int
, category_details : Maybe CategoryDetails
, language : Maybe String
, nsfw : Bool
, is_premium : Bool
, is_locked : Bool
, user : User
, group : Maybe Group
, topic : Maybe Topic
, related : RelatedPosts
}

One post returned from one of the feed reader functions.

type alias PostList =
List Post

A list of Post instances.

type alias Embed =
{ html : String
, iframe : Bool
}

Embed in a Post.

type alias CategoryDetails =
{ title : String
, slug : String
, value : Int
, emoji : String
}

Category details in a Post.

type alias Group =
{ id : String
, title : String
, pinned_post_id : String
, cover_url : String
, description : String
, is_private : Bool
, is_joined : Bool
}

Group description for a Post.

type alias Topic =
{ id : String
, created_at : String
, is_featured : Bool
, title : String
, category : Int
, user : Maybe User
}

The topic of a Post.

Attachments

= NoAttachment
| UrlAttachment UrlRecord
| MediaAttachment (List MediaRecord)
| YoutubeAttachment String
| GiphyAttachment String
| UnknownAttachment UnknownAttachmentRecord

Attachment to a Post.

type alias UrlRecord =
{ image : String
, title : Maybe String
, description : Maybe String
, url : String
, source : String
}

Details of a UrlAttachment.

type alias MediaRecord =
{ id : String
, url_thumbnail : String
, url_full : String
, width : Int
, height : Int
}

Details for a MediaAttachment.

{ type_ : String
, value : Value
}

Data about an UnknownAttachment.

Creating a new post

type alias PostForm =
{ body : String
, reply_to : Maybe String
, is_quote : Bool
, is_html : Bool
, nsfw : Bool
, is_premium : Bool
, gif : Maybe String
, topic : Maybe String
, group : Maybe String
, media_attachments : List String
, premium_min_tier : Maybe Int
, poll : Bool
, poll_option_1 : Maybe String
, poll_option_2 : Maybe String
, poll_option_3 : Maybe String
, poll_option_4 : Maybe String
}

Creating a new post

Returned from operations that have no useful data except successful completion.

type alias Success =
{ state : Bool
, message : String
}

Returned from upvotePost, downvotePost, follow, mute.

Persistent tokens

type alias SavedToken =
{ expiresAt : Maybe Int
, refreshToken : Maybe Token
, scope : List String
, token : Token
}

Persistent form of an OAuthMiddleware.ResponseToken.

Use Gab.savedTokenFromResponseToken to make one of these.