melon-love / elm-gab-api / Gab.Types

Shared Types for the Gab API.

Http Requests


type alias RequestParts msg =
{ method : String
, headers : List Http.Header
, url : String
, body : HttpBody
, expect : Http.Expect msg
, timeout : Maybe Basics.Float
, tracker : Maybe String 
}

Names the argument to Http.request with HttpBody.


type HttpBody
    = EmptyBody
    | JsonBody Json.Encode.Value
    | StringBody String String
    | FileBody File
    | OtherBody Http.Body

A custom type for request bodies.

Http Results


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

Returned from the Post and Delete actions


type PostResultState
    = UnknownState
    | SuccessState

The value of PostResult.state for a successful operation.

Users


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

Details of a Gab user.


type alias UserList =
{ data : List User
, no_more : Basics.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 : Basics.Bool 
}

A list of ActivityLog instances.

Notifications


type NotificationType
    = LikeNotification
    | RepostNotification
    | FollowNotification
    | MentionNotification
    | UnknownNotification String

The type of a notification.


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

The result from Gab.notifications


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

A single notification.

Posts


type alias Post =
{ id : String
, created_at : String
, revised_at : Maybe String
, edited : Basics.Bool
, body : String
, body_html : Maybe String
, body_html_summary : Maybe String
, body_html_summary_truncated : Basics.Bool
, only_emoji : Basics.Bool
, liked : Basics.Bool
, disliked : Basics.Bool
, bookmarked : Basics.Bool
, repost : Basics.Bool
, reported : Basics.Bool
, score : Basics.Int
, like_count : Basics.Int
, dislike_count : Basics.Int
, reply_count : Basics.Int
, repost_count : Basics.Int
, is_quote : Basics.Bool
, is_reply : Basics.Bool
, is_replies_disabled : Basics.Bool
, embed : Maybe Embed
, attachment : Attachment
, category : Maybe Basics.Int
, category_details : Maybe CategoryDetails
, language : Maybe String
, nsfw : Basics.Bool
, is_premium : Basics.Bool
, is_locked : Basics.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 : Basics.Bool 
}

Embed in a Post.


type alias CategoryDetails =
{ title : String
, slug : String
, value : Basics.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 : Basics.Bool
, is_joined : Basics.Bool 
}

Group description for a Post.


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

The topic of a Post.


type RelatedPosts
    = RelatedPosts ({ parent : Maybe Post, replies : PostList })

Part of a Post.

Attachments


type Attachment
    = 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 : Basics.Int
, height : Basics.Int 
}

Details for a MediaAttachment.


type alias UnknownAttachmentRecord =
{ type_ : String
, value : Json.Encode.Value 
}

Data about an UnknownAttachment.

Creating a new post


type alias PostForm =
{ body : String
, reply_to : Maybe String
, is_quote : Basics.Bool
, is_html : Basics.Bool
, nsfw : Basics.Bool
, is_premium : Basics.Bool
, gif : Maybe String
, topic : Maybe String
, group : Maybe String
, media_attachments : List String
, premium_min_tier : Maybe Basics.Int
, poll : Basics.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 : Basics.Bool
, message : String 
}

Returned from upvotePost, downvotePost, follow, mute.

Persistent tokens


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

Persistent form of an OAuthMiddleware.ResponseToken.

Use Gab.savedTokenFromResponseToken to make one of these.