Documentation ¶
Overview ¶
Package discuit provides easy interaction with the Discuit API.
Index ¶
- Constants
- type Badge
- type Client
- func (c *Client) AddComment(postID, parentCommentID, content string, userType userGroup) (Comment, error)
- func (c *Client) AddCommunityMod(communityID, username string) ([]User, error)
- func (c *Client) AddCommunityRule(communityID, rule, description string) ([]CommunityRule, error)
- func (c *Client) ChangePassword(current, newPass, repeatNewPass string) error
- func (c *Client) CreatePost(title, content, communityName string, typeOfPost postType, group userGroup) (Post, error)
- func (c *Client) DeleteComment(postPublicID, commentID string, deleteAs userGroup) (Comment, error)
- func (c *Client) DeleteCommunityRule(communityID string, ruleID int) (CommunityRule, error)
- func (c *Client) DeleteNotification(notificationID int) (Notification, error)
- func (c *Client) DeletePost(publicID string, deleteAs userGroup, deleteContent bool) (Post, error)
- func (c *Client) DownvoteComment(commentID string) (Comment, error)
- func (c *Client) DownvotePost(postID string) (Post, error)
- func (c *Client) GetAllNotifications() ([]Notification, error)
- func (c *Client) GetAllPosts(sort postSort) ([]Post, error)
- func (c *Client) GetCommentsFromPost(postPublicID, paginationCursor string) ([]Comment, string, error)
- func (c *Client) GetCommunity(id string) (Community, error)
- func (c *Client) GetCommunityByName(name string) (Community, error)
- func (c *Client) GetCommunityMods(communityID string) ([]User, error)
- func (c *Client) GetCommunityPosts(communityID string, sort postSort) ([]Post, error)
- func (c *Client) GetCommunityRules(communityID string) ([]CommunityRule, error)
- func (c *Client) GetCurrentUser() (User, error)
- func (c *Client) GetNotification(notificationID int) (Notification, error)
- func (c *Client) GetPost(publicID string) (Post, error)
- func (c *Client) GetUser(username string) (User, error)
- func (c *Client) JoinCommunity(communityID string) (Community, error)
- func (c *Client) LeaveCommunity(communityID string) (Community, error)
- func (c *Client) Login(username, password, instanceURL string) error
- func (c *Client) Logout() error
- func (c *Client) NewRequest(method, path, body string) (*http.Request, error)
- func (c *Client) RemoveCommunityMod(communityID, username string) (User, error)
- func (c *Client) SearchAllCommunities(query string) ([]Community, error)
- func (c *Client) UpdateComment(postPublicID, commentID, newContent string) (Comment, error)
- func (c *Client) UpdateCommunityRule(communityID string, ruleID int, rule, description string, zIndex int) (CommunityRule, error)
- func (c *Client) UpdateNotifications(action notificationAction) error
- func (c *Client) UpdatePost(publicID, newTitle, newBody string) (Post, error)
- func (c *Client) UpdateProfile(aboutMe, email string, homeFeed homeFeedSort, ...) (User, error)
- func (c *Client) UpvoteComment(commentID string) (Comment, error)
- func (c *Client) UpvotePost(postID string) (Post, error)
- type Comment
- type Community
- type CommunityRule
- type Image
- type ImageCopy
- type List
- type ListItem
- type Mute
- type Notification
- type NotificationCommentReply
- type NotificationDeletedPost
- type NotificationModAdd
- type NotificationNewBadge
- type NotificationNewComment
- type NotificationNewVotes
- type Post
- type Report
- type ReportReason
- type User
Constants ¶
const ( NotificationActionResetNewCount = iota NotificationActionMarkAllAsSeen NotificationActionDeleteAll )
const ( PostSortLatest = postSort(iota) PostSortHot PostSortActivity PostSortDay PostSortWeek PostSortMonth PostSortYear PostSortAll )
const ( UserGroupNormal = iota UserGroupMods UserGroupAdmins )
const ( PostTypeText = iota PostTypeImage PostTypeLink )
const ( HomeFeedAll = iota HomeFeedSubsricptions )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Badge ¶
type Badge struct { ID int `json:"id"` // The ID of the badge. Type string `json:"type"` // The type of badge. }
A Badge is an award a User receives for a certain action, like donating on Patreon.
type Client ¶
A Client stores the username and password of an account and it has methods that can be used to send requests to the Discuit API.
func (*Client) AddComment ¶ added in v0.3.1
func (c *Client) AddComment(postID, parentCommentID, content string, userType userGroup) (Comment, error)
AddComment comments on a post. If parentCommentID is not blank, the comment will reply to it. userType is whether the user is posting as a normal user, as an admin, or as a mod.
func (*Client) AddCommunityMod ¶
Add a user as a moderator of a community.
func (*Client) AddCommunityRule ¶
func (c *Client) AddCommunityRule(communityID, rule, description string) ([]CommunityRule, error)
Add a rule for a community.
func (*Client) ChangePassword ¶ added in v0.3.2
ChangePassword allows a user to change their password. Accepts the current, new, and a repeat of the new passwords.
func (*Client) CreatePost ¶ added in v0.3.1
func (c *Client) CreatePost(title, content, communityName string, typeOfPost postType, group userGroup) (Post, error)
Create a new post in the specified community with the specified content, and the specified post type.
func (*Client) DeleteComment ¶ added in v0.3.1
DeleteComment deletes a comment. If using UserGroupNormal, the original poster is deleting the comment. If the admin or mod is deleting the post, it usually is because it violates a rule or something.
func (*Client) DeleteCommunityRule ¶
func (c *Client) DeleteCommunityRule(communityID string, ruleID int) (CommunityRule, error)
Delete a rule of a community.
func (*Client) DeleteNotification ¶
func (c *Client) DeleteNotification(notificationID int) (Notification, error)
Delete an individual notification by its ID.
func (*Client) DeletePost ¶ added in v0.3.1
Delete a post by its public ID. Set deleteContent to true to delete the post's content as well.
func (*Client) DownvoteComment ¶ added in v0.3.1
Downvote a comment by its ID.
func (*Client) DownvotePost ¶
Downvote a post by its ID.
func (*Client) GetAllNotifications ¶
func (c *Client) GetAllNotifications() ([]Notification, error)
Gets all the notifications of the authenticated user.
func (*Client) GetAllPosts ¶ added in v0.3.1
Get all posts with in a specific order.
func (*Client) GetCommentsFromPost ¶ added in v0.3.1
func (c *Client) GetCommentsFromPost(postPublicID, paginationCursor string) ([]Comment, string, error)
GetCommentsFromPost gets the comments on a post by the post's PublicID. The PaginationCursor parameter can be used to paginate the comments. Returns a slice of comments, the pagination cursor for the next page, and an error (if applicable).
func (*Client) GetCommunity ¶
Get a community by ID.
func (*Client) GetCommunityByName ¶
Fetch a community by its name.
func (*Client) GetCommunityMods ¶
Get all of the moderators of a community.
func (*Client) GetCommunityPosts ¶ added in v0.3.5
func (*Client) GetCommunityRules ¶
func (c *Client) GetCommunityRules(communityID string) ([]CommunityRule, error)
Get a list of rules of a community.
func (*Client) GetCurrentUser ¶ added in v0.3.2
GetCurrentUser returns the User object of the current session.
func (*Client) GetNotification ¶
func (c *Client) GetNotification(notificationID int) (Notification, error)
Get an individual notification by its ID.
func (*Client) GetUser ¶ added in v0.3.2
GetUser returns the User object for a given username, or an error if the name is not found.
func (*Client) JoinCommunity ¶
Make the authenticated user join a community. This requires the community ID.
func (*Client) LeaveCommunity ¶
Make the authenticated user leave a community. Requires the community ID.
func (*Client) NewRequest ¶
Create a request to the Discuit API. This does not send the request, you must do that on your own.
func (*Client) RemoveCommunityMod ¶
Remove a user as moderator of a community.
func (*Client) SearchAllCommunities ¶
Get or Search all the existing communities. If query is blank, it will return every existing community. If query is set, it will filter out the communities that don't have the query in their name.
func (*Client) UpdateComment ¶ added in v0.3.1
UpdateComment is used to replace the bod of a comment with new text.
func (*Client) UpdateCommunityRule ¶
func (c *Client) UpdateCommunityRule(communityID string, ruleID int, rule, description string, zIndex int) (CommunityRule, error)
Update a rule of a community. zIndex is the number of the rule, like Rule 1. If any fields are left blank, they will be set to "".
func (*Client) UpdateNotifications ¶
Update all notifications by deleting them, marking them all as seen, or resetting the count of new notifications. Accepts one of the NotificationAction* variables as an action.
func (*Client) UpdatePost ¶ added in v0.3.1
Updates a post by the given public ID. It replaces the current title with the new one, and some for the body. If you don't want to change one of these fields, leave it blank.
func (*Client) UpdateProfile ¶ added in v0.3.2
func (c *Client) UpdateProfile( aboutMe, email string, homeFeed homeFeedSort, upvoteNotificationsOff, replyNotificationsOff, rememberFeedSort, hideUserProfilePictures, embedsOff bool, ) (User, error)
UpdateProfile edits the user's settings. If any fields are left blank, they will be reset.
func (*Client) UpvoteComment ¶ added in v0.3.1
Upvote a comment by its ID.
type Comment ¶
type Comment struct { ID string `json:"id"` // The comment's ID. PostID string `json:"postId"` // The ID of the post the comment belongs to. PublicPostID string `json:"publicPostID"` // The public ID of the post that the comment belongs to. CommunityID string `json:"communityID"` // The ID of the community the comment was posted in. CommunityName string `json:"communityName"` // The name of the community the comment was posted in. UserID string `json:"userId"` // The ID of the user that posted the comment. Username string `json:"username"` // The username of the user that made the comment. UserGhostID string `json:"userGhostId"` // The ID of the Ghost user (only if the account was deleted). UserGroup string `json:"userGroup"` // One of "normal", "mods", or "admins": the capacity in which the comment was made. ParentID string `json:"parentId"` // The comment ID that this comment is replying to. Empty if this is a top-level comment. Depth int `json:"depth"` // How far deep into a chain this comment is. Top-level comments have depth 0. NumReplies int `json:"noReplies"` // The amount of replies to the comment. NumDirectReplies int `json:"noDirectReplies"` // The amount of replies directly to this comment, not replies to replies. Ancestors []string `json:"ancestors"` // The chain of comments leading back to the original comment. Body string `json:"body"` // The body of the comment. Upvotes int `json:"upvotes"` // The amount of upvotes the comment has. Downvotes int `json:"downvotes"` // The amount of downvotes the comment has. CreatedAt time.Time `json:"createdAt"` // When the comment was made. EditedAt time.Time `json:"editedAt"` // When the comment was last edited. ContentStripped bool `json:"contentStripped"` // Whether the comment's content was deleted. Deleted bool `json:"deleted"` // Whether or not the comment was deleted. DeletedAt time.Time `json:"deletedAt"` // If the comment was deleted, the date and time of deletion. DeletedAs string `json:"deletedAs"` // Who deleted the comment. One of "mods", "admins", or "normal". Author User `json:"author"` // The author of the comment, as a User{} struct. IsAuthorMuted bool `json:"isAuthorMuted"` // Whether or not the authenticated user has muted the author. False if not autehnticated. UserVoted bool `json:"userVoted"` // Whether or not the authenticated user has voted. UserVotedUp bool `json:"userVotedUp"` // If the user has voted, whether is was an upvote or a downvote. PostTitle string `json:"postTitle"` // The title of the post the comment belongs to. PostDeleted bool `json:"postDeleted"` // Whether or not the comment's post was deleted. PostDeletedAs string `json:"postDeletedAs"` // Who deleted the comment's post. One of "mods", "admins", or "normal". }
A Comment holds the information relating to a comment from the Discuit API.
type Community ¶
type Community struct { ID string `json:"id"` // The ID of the community. UserID string `json:"userId"` // The ID of the user who made the community. Name string `json:"name"` // The name of the community. NSFW bool `json:"nsfw"` // Whether or not the community hosts NSFW content. About string `json:"about"` // The description of the community. NumMembers int `json:"noMembers"` // The amount of users who have joined the community. ProPic Image `json:"proPic"` // The community's icon. BannerImage Image `json:"bannerImage"` // The community's banner image. CreatedAt time.Time `json:"createdAt"` // The time the community was created at. DeletedAt time.Time `json:"deletedAt"` // The time the community was deleted at (if it was ever deleted). IsDefault bool `json:"isDefault"` // Whether or not the community is one that the user joins by default. UserJoined bool `json:"userJoined"` // Whether or not the authenticated user has joined the community. UserMod bool `json:"userMod"` // Whether or not the authenticated user moderates this community. IsMuted bool `json:"isMuted"` // Whether or not the authenticated user has muted this community. Mods []User `json:"mods"` // The moderators of this community. Rules []CommunityRule `json:"rules"` // The community rules. ReportsDetails interface{} `json:"ReportsDetails"` // If the community has been reported, the reasons given. }
A Community is a forum in which Users can post and comment.
type CommunityRule ¶
type CommunityRule struct { ID int `json:"id"` // The ID of the rule. Rule string `json:"rule"` // The title of the rule. Description string `json:"description"` // A description of the rule. CommunityID string `json:"communityId"` // The ID of the community the rule is for. ZIndex int `json:"zIndex"` // The index of the rule. Smaller means closer to the top of the list. CreatedBy string `json:"createdBy"` // Who created the rule. CreatedAt time.Time `json:"createdAt"` // When the rule was created. }
A CommunityRule is a rule that users of a community must follow in their Posts and Comments.
type Image ¶
type Image struct { ID string `json:"id"` // The ID of the image. Format string `json:"format"` // The image format. One of "jpeg", "webp", "png". Mimetype string `json:"mimetype"` // The image MIME type, e.g. "image/png". Width int `json:"width"` // The image width. Height int `json:"height"` // The image height. Size int `json:"size"` // The image size, in bytes. AverageColor string `json:"averageColor"` // The average color of the image, in this format: "rgb(r, g, b)". URL string `json:"url"` // The path to the image. Copies []ImageCopy `json:"copies"` // Copies of the image in different sizes. }
An Image holds the information relevant to an image, such as size, color, and copies.
type ImageCopy ¶
type ImageCopy struct { Name string `json:"name"` // The name of the image copy, used to identify it. Width int `json:"width"` // The width of the copy. Height int `json:"height"` // The height of the copy. BoxWidth int `json:"boxWidth"` // The width of the box the image fits into. BoxHeight int `json:"boxHeight"` // The height of the box the image fits into. ObjectFit string `json:"objectFit"` // How the image should fit into the box. Corrersponds to the CSS `object-fit`. Format string `json:"format"` // The image format. URL string `json:"url"` // A link to the image. }
An ImageCopy contains the properties that a copy of the image has, such as name, size, format, and more.
type List ¶
type List struct { ID int `json:"id"` // The ID of the list. UserID string `json:"userId"` // The ID of the user who owns the list. Username string `json:"username"` // The username of the user who owns the list. Name string `json:"name"` // The name of the list. DisplayName string `json:"displayName"` // The list's display name. Description string `json:"description"` // The list's description. Public bool `json:"public"` // Whether or not the list is public. NumItems int `json:"numItems"` // The amount of items in the list. Sort string `json:"sort"` // How the list is currently sorted. One of "addedDsc", "addedAsc", "createdDsc", or "createdAsc". CreatedAt time.Time `json:"createdAt"` // When the lsit was created. LastUpdatedAt time.Time `json:"lastUpdatedAt"` // When the list was last updated. }
A List is a struct that contains a lis of comments and/or posts that a user has saved.
type ListItem ¶
type ListItem struct { ID int `json:"id"` // The ID of the list item. ListID int `json:"listId"` // The ID of the list the item belongs to. TargetType string `json:"targetType"` // The type of item the user has saved. One of "post" or "comment". TargetID string `json:"targetId"` // The ID of the item saved to the list. CreatedAt time.Time `json:"createdAt"` // The time at which the item was saved. TargetItem interface{} `json:"targetItem"` // Either a Post{} or a Comment{}, the item that was saved. }
A ListItem is an object that a User has saved to a List.
type Mute ¶
type Mute struct { ID string `json:"id"` // The ID of the mute. Type string `json:"type"` // The type of the mute. One of "community" or "user". MutedUserID string `json:"mutedUserId"` // If the muted object is a user, the user's ID. MutedCommunityID string `json:"mutedCommunityId"` // If the muted object is a community, its ID. CreatedAt time.Time `json:"createdAt"` // The time at which the object was muted. MutedUser User `json:"mutedUser"` // If the muted object is a User, its User object. MutedCommunity Community `json:"mutedUser"` // If the muted object is a Community, its object. }
A Mute saves the details of something a User has muted.
type Notification ¶
type Notification struct { ID int `json:"id"` // The ID of the notification. Type string `json:"type"` // The type of notification. One of "new_comment", "comment_reply", "new_votes", "deleted_post", or "mod_add". RawNotification interface{} `json:"notif"` // The notification body itself, depending on the type. Seen bool `json:"seen"` // If the notification has been seen by the user. SeenAt time.Time `json:"seenAt"` // When the notification was seen. CreatedAt time.Time `json:"createdAt"` // When the notification was created. }
A Notification is a message to a User about an upvote, reply, or deletion of their Post or Comment.
type NotificationCommentReply ¶
type NotificationCommentReply struct { CommentAuthor string `json:"commentAuthor"` // Who wrote the comment. CommentID string `json:"commentId"` // The ID of the comment. FirstCreatedAt time.Time `json:"firstCreatedAt"` // When the first comment was made. NumComments int `json:"noComments"` // The amount of new comments on the post. ParentCommentID string `json:"parentCommentID"` // The comment that this comment is replying to. Post Post `json:"post"` // The parent post. PostID string `json:"postId"` // The ID of the parent post. }
A NotificationCommentReply is sent to a user when their comment receives a reply.
type NotificationDeletedPost ¶
type NotificationDeletedPost struct { DeletedAs string `json:"deletedAs"` // The user group that deleted the post. Either "mods" or "admins". Post Post `json:"post"` // The post that was deleted. TargetID string `json:"targetId"` // The ID of the post that was deleted. TargetType string `json:"targetType"` // Whether the affected item is a post or a comment. }
A NotificationDeletedPost is a Notification in which the type is "deleted_post", which means that if Notification.Type is "deleted_post", Notification.Notification() returns a NotificationDeletedPost.
type NotificationModAdd ¶
type NotificationModAdd struct { AddedBy string `json:"addedBy"` // The user who added the person as moderator. Community Community `json:"community"` // The community that the person is now moderator of. CommunityName string `json:"communityName"` // The name of the community. }
A NotificationModAdd is sent to a User when they are added as a moderator of a Community.
type NotificationNewBadge ¶
type NotificationNewBadge struct { BadgeType string `json:"badgeType"` // The name of the badge. User User `json:"user"` // The user who received the badge. }
A NotificationNewBadge is a Notification sent to a User when they receive a new Badge.
type NotificationNewComment ¶
type NotificationNewComment struct { CommentAuthor string `json:"commentAuthor"` // Who wrote the comment. CommentID string `json:"commentId"` // The ID of the comment. FirstCreatedAt time.Time `json:"firstCreatedAt"` // When the first comment was made. NumComments int `json:"noComments"` // The amount of new comments on the post. Post Post `json:"post"` // The parent post. PostID string `json:"postId"` // The ID of the parent post. }
A NotificationNewComment is sent to the user when someone comments on their Post.
type NotificationNewVotes ¶
type NotificationNewVotes struct { NumVotes string `json:"noVotes"` // The amount of new votes. TargetID string `json:"targetId"` // The ID of the item that received the new votes. TargetType string `json:"targetType"` // The type of item being voted on. Either "post" or "comment". Post Post `json:"post"` // The post, if the voted item is a post, otherwise the post that the comment belongs to. Comment Comment `json:"comment"` // If TargetType is "comment", the comment as a Comment struct. }
A NotificationNewVotes represents a Notification for which the type is "new_votes", meaning if Notification.Type == "new_votes", Notification.RawNotification is of type NotificationNewVotes.
type Post ¶
type Post struct { ID string `json:"id"` // The ID of the post. Type string `json:"type"` // The type of post. One of "image", "link", or "text". PublicID string `json:"publicId"` // The public ID of the post, the value in discuit.net/commandline/post/{publicId}. UserID string `json:"userId"` // The ID of the user who created the post. Username string `json:"username"` // The username of the user who created the post. UserGroup string `json:"userGroup"` // In what capacity the post was created. One of "normal", "mods", or "admins". UserGhostID string `json:"userGhostId"` // The ghost ID of the user in case they deleted their account. UserDeleted bool `json:"userDeleted"` // If the account was deleted. IsPinned bool `json:"isPinned"` // If the post is pinned in the community. IsPinnedSite bool `json:"isPinnedSite"` // If the post is pinned site-wide. CommunityID string `json:"communityId"` // The ID of the community the post was created in. CommunityName string `json:"communityName"` // The name of the community the post was made in. CommunityProPic Image `json:"communityProPic"` // The icon of the community that the post belongs to. CommunityBannerImage Image `json:"communityBannerImage"` // THe banner image of the community. Title string `json:"title"` // The title of the post. Body string `json:"body"` // The body of the post, if the post's type is "text". Image Image `json:"image"` // The image of the post, if the post's type is "image". Link struct { URL string `json:"url"` // The URL of the link. Hostname string `json:"hostname"` // The host of the link. Image Image `json:"image"` // The image preview of the link. } `json:"link"` // The link struct for the post, if the post if of type "link". Locked bool `json:"locked"` // If the post has been locked. LockedBy string `json:"lockedBy"` // Who locked the post. LockedByGroup string `json:"lockedByGroup"` // Who locked the post. One of "admins", "mods", or "normal". LockedAt time.Time `json:"lockedAt"` // When the post was locked. Upvotes int `json:"upvotes"` // The amount of upvotes the post has received. Downvotes int `json:"downvotes"` // The amount of downvotes the post has received. Hotness int64 `json:"hotness"` // Used when ordering posts by "hot". CreatedAt time.Time `json:"createdAt"` // When the post was created. EditedAt time.Time `json:"editedAt"` // When the post was last edited. LastActivityAt time.Time `json:"lastActivityAt"` // When either the psot was created or the latest comment was made. Deleted bool `json:"deleted"` // If the post is deleted. DeletedBy time.Time `json:"deletedBy"` // Who deleted the post. DeletedAt time.Time `json:"deletedAt"` // When the post was deleted. DeletedAs time.Time `json:"deletedAs"` // In what capacity the post was deleted. One of "admins", "mods", or "normal". DeletedContent bool `json:"deletedContent"` // If true, the body of the post and all associated links or images are deleted. DeletedContentAs string `json:"deletedContentAs"` // In what capacity the content was deleted, empty if the content has not been deleted. NumComments int `json:"noComments"` // The amount of comments on the post. Comments []Comment `json:"comments"` // The comments replying to the post. CommentsNext string `json:"commentsNext"` // The pagination cursor for comments. UserVoted bool `json:"userVoted"` // If the athenticated user has voted. UserVotedUp bool `json:"userVotedUp"` // If the authenticated user has upvoted or downvoted. IsAuthorMuted bool `json:"isAuthorMuted"` // Whether the author of the post is muted by the authenticated User IsCommunityMuted bool `json:"isCommunityMuted"` // Whether the authenticated User has muted the community of the post. Community Community `json:"community"` // The community the post was made in, as a Community struct. Author User `json:"author"` // The author of the post, as a User struct. }
A Post is a struct containing information about something posted in a Community.
type Report ¶
type Report struct { ID int `json:"id"` // The ID of the report. CommunityID string `json:"communityId"` // The ID of the community in which the report was made. PostID string `json:"postId"` // If a post is being reported, its ID. Reason string `json:"reason"` // WHy the report is being made. This is chosen from the site-wide list of reasons. Description string `json:"description"` // A description of the report. Empty if no description. ReasonID int `json:"reasonId"` // The ID of the report reason. Type string `json:"type"` // The type of item being reported. Either "post" or "comment". TargetID string `json:"targetId"` // The ID of the post or comment being reported. ActionTaken string `json:"actionTaken"` // If an action was taken, a short description. DealtAt time.Time `json:"dealtAt"` // When the report was dealt with. DealtBy string `json:"dealtBy"` // Who dealt with the report. CreatedAt time.Time `json:"createdAt"` // When the report was created. Target interface{} `json:"target"` // Either a Post{} or a Comment{}; the item being reported. }
A Report generally is a problem with a post or comment that the moderators or administrators should take care of.
type ReportReason ¶
type ReportReason struct { ID int `json:"id"` // The ID of the report reason. Title string `json:"title"` // The title of the reason. Description string `json:"description"` // A short description of the reason. }
A ReportReason is one of multiple site-wide default reasons for a User to create a Report.
type User ¶
type User struct { ID string `json:"id"` // The ID of the user. Username string `json:"username"` // The username of the user. Minimum 3, maximum 21 characters. Email string `json:"email"` // The email of the user. EmailConfirmedAt time.Time `json:"emailConfirmedAt"` // The time and date the email was confirmed at. AboutMe string `json:"aboutMe"` // A short biography set by the user. Maximum 10000 characters. Points int `json:"points"` // The amount of points the user has. IsAdmin bool `json:"isAdmin"` // If the user is an admin. ProPic Image `json:"proPic"` // The user's profile picture. Badges []Badge `json:"badges"` // The user's badges, can be empty. NumPosts int `json:"noPosts"` // The amount of posts the user has made. NumComments int `json:"noComments"` // The amount of comments the user has made. CreatedAt time.Time `json:"createdAt"` // When the user joined. Deleted bool `json:"deleted"` // If the account has been deleted. DeletedAt time.Time `json:"deletedAt"` // When the account was deleted. UpvoteNotificationsOff bool `json:"upvoteNotificationsOff"` // If notifications for upvotes on their posts/comments are off. ReplyNotificationsOff bool `json:"replyNotificationsOff"` // If notifications for replies to their posts/comments are off. HomeFeed string `json:"homeFeed"` // The feed the user has set as their home feed. RememberFeedSort bool `json:"rememberFeedSort"` // If the user wants their feed sort to be remembered. EmbedsOff bool `json:"embedsOff"` // If the user has disabled embeds for link posts. HideUserProfilePictures bool `json:"hideUserProfilePictures"` // If the user has enabled hiding profile pictures. BannedAt time.Time `json:"bannedAt"` // If the user was banned, the date and time. IsBanned bool `json:"isBanned"` // Whether the user is banned. NotificationsNewCount int `json:"notificationsNewCount"` // The amount of new notifications the user has. ModdingList []Community `json:"moddingList"` // A list of communities the user moderates. }
A User is a person who has an account on the Discuit instance.