diff --git a/pkg/mastotypes/model/account.go b/pkg/mastotypes/model/account.go
index 4de7f4d19..031fa7c02 100644
--- a/pkg/mastotypes/model/account.go
+++ b/pkg/mastotypes/model/account.go
@@ -1,4 +1,69 @@
+/*
+ GoToSocial
+ Copyright (C) 2021 GoToSocial Authors admin@gotosocial.org
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+*/
+
package mastotypes
+// Account represents a mastodon-api Account object, as described here: https://docs.joinmastodon.org/entities/account/
type Account struct {
+ // The account id
+ ID string `json:"id"`
+ // The username of the account, not including domain.
+ Username string `json:"username"`
+ // The Webfinger account URI. Equal to username for local users, or username@domain for remote users.
+ Acct string `json:"acct"`
+ // The profile's display name.
+ DisplayName string `json:"display_name"`
+ // Whether the account manually approves follow requests.
+ Locked bool `json:"locked"`
+ // Whether the account has opted into discovery features such as the profile directory.
+ Discoverable bool `json:"discoverable"`
+ // A presentational flag. Indicates that the account may perform automated actions, may not be monitored, or identifies as a robot.
+ Bot bool `json:"bot"`
+ // When the account was created. (ISO 8601 Datetime)
+ CreatedAt string `json:"created_at"`
+ // The profile's bio / description.
+ Note string `json:"note"`
+ // The location of the user's profile page.
+ URL string `json:"url"`
+ // An image icon that is shown next to statuses and in the profile.
+ Avatar string `json:"avatar"`
+ // A static version of the avatar. Equal to avatar if its value is a static image; different if avatar is an animated GIF.
+ AvatarStatic string `json:"avatar_static"`
+ // An image banner that is shown above the profile and in profile cards.
+ Header string `json:"header"`
+ // A static version of the header. Equal to header if its value is a static image; different if header is an animated GIF.
+ HeaderStatic string `json:"header_static"`
+ // The reported followers of this profile.
+ FollowersCount int `json:"followers_count"`
+ // The reported follows of this profile.
+ FollowingCount int `json:"following_count"`
+ // How many statuses are attached to this account.
+ StatusesCount int `json:"statuses_count"`
+ // When the most recent status was posted. (ISO 8601 Datetime)
+ LastStatusAt string `json:"last_status_at"`
+ // Custom emoji entities to be used when rendering the profile. If none, an empty array will be returned.
+ Emojis []Emoji `json:"emojis"`
+ // Additional metadata attached to a profile as name-value pairs.
+ Fields []Field `json:"fields"`
+ // An extra entity returned when an account is suspended.
+ Suspended bool `json:"suspended"`
+ // When a timed mute will expire, if applicable. (ISO 8601 Datetime)
+ MuteExpiresAt string `json:"mute_expires_at"`
+ // An extra entity to be used with API methods to verify credentials and update credentials.
+ Source *Source `json:"source"`
}
diff --git a/pkg/mastotypes/model/card.go b/pkg/mastotypes/model/card.go
index cddc42d5b..097ebbd30 100644
--- a/pkg/mastotypes/model/card.go
+++ b/pkg/mastotypes/model/card.go
@@ -18,5 +18,7 @@
package mastotypes
+// Card represents a rich preview card that is generated using OpenGraph tags from a URL. See here: https://docs.joinmastodon.org/entities/card/
type Card struct {
+
}
diff --git a/pkg/mastotypes/model/emoji.go b/pkg/mastotypes/model/emoji.go
index ba666023e..520bf9198 100644
--- a/pkg/mastotypes/model/emoji.go
+++ b/pkg/mastotypes/model/emoji.go
@@ -19,4 +19,19 @@
package mastotypes
type Emoji struct {
+ // REQUIRED
+
+ // The name of the custom emoji.
+ Shortcode string `json:"shortcode"`
+ // A link to the custom emoji.
+ URL string `json:"url"`
+ // A link to a static copy of the custom emoji.
+ StaticURL string `json:"static_url"`
+ // Whether this Emoji should be visible in the picker or unlisted.
+ VisibleInPicker bool `json:"visible_in_picker"`
+
+ // OPTIONAL
+
+ // Used for sorting custom emoji in the picker.
+ Category string `json:"category,omitempty"`
}
diff --git a/pkg/mastotypes/model/field.go b/pkg/mastotypes/model/field.go
new file mode 100644
index 000000000..0de91cd47
--- /dev/null
+++ b/pkg/mastotypes/model/field.go
@@ -0,0 +1,34 @@
+/*
+ GoToSocial
+ Copyright (C) 2021 GoToSocial Authors admin@gotosocial.org
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+*/
+
+package mastotypes
+
+// Field represents a profile field as a name-value pair with optional verification. See https://docs.joinmastodon.org/entities/field/
+type Field struct {
+ // REQUIRED
+
+ // The key of a given field's key-value pair.
+ Name string `json:"name"`
+ // The value associated with the name key.
+ Value string `json:"value"`
+
+ // OPTIONAL
+
+ // Timestamp of when the server verified a URL value for a rel="me” link. String (ISO 8601 Datetime) if value is a verified URL
+ VerifiedAt string `json:"verified_at,omitempty"`
+}
\ No newline at end of file
diff --git a/pkg/mastotypes/model/poll.go b/pkg/mastotypes/model/poll.go
index 799fe35bf..eab069970 100644
--- a/pkg/mastotypes/model/poll.go
+++ b/pkg/mastotypes/model/poll.go
@@ -18,11 +18,40 @@
package mastotypes
+// Poll represents the mastodon-api poll type, as described here: https://docs.joinmastodon.org/entities/poll/
type Poll struct {
+ // The ID of the poll in the database.
+ ID string `json:"id"`
+ // When the poll ends. (ISO 8601 Datetime), or null if the poll does not end
+ ExpiresAt string `json:"expires_at"`
+ // Is the poll currently expired?
+ Expired bool `json:"expired"`
+ // Does the poll allow multiple-choice answers?
+ Multiple bool `json:"multiple"`
+ // How many votes have been received.
+ VotesCount int `json:"votes_count"`
+ // How many unique accounts have voted on a multiple-choice poll. Null if multiple is false.
+ VotersCount int `json:"voters_count,omitempty"`
+ // When called with a user token, has the authorized user voted?
+ Voted bool `json:"voted,omitempty"`
+ // When called with a user token, which options has the authorized user chosen? Contains an array of index values for options.
+ OwnVotes []int `json:"own_votes,omitempty"`
+ // Possible answers for the poll.
+ Options []PollOptions `json:"options"`
+ // Custom emoji to be used for rendering poll options.
+ Emojis []Emoji `json:"emojis"`
+}
+
+// PollOptions represents the current vote counts for different poll options
+type PollOptions struct {
+ // The text value of the poll option. String.
+ Title string `json:"title"`
+ // The number of received votes for this option. Number, or null if results are not published yet.
+ VotesCount int `json:"votes_count,omitempty"`
}
// PollRequest represents a mastodon-api poll attached to a status POST request, as defined here: https://docs.joinmastodon.org/methods/statuses/
-// It should be used at the path https://mastodon.example/api/v1/statuses
+// It should be used at the path https://example.org/api/v1/statuses
type PollRequest struct {
// Array of possible answers. If provided, media_ids cannot be used, and poll[expires_in] must be provided.
Options []string `form:"options"`
diff --git a/pkg/mastotypes/model/source.go b/pkg/mastotypes/model/source.go
new file mode 100644
index 000000000..e4a2ca06a
--- /dev/null
+++ b/pkg/mastotypes/model/source.go
@@ -0,0 +1,22 @@
+/*
+ GoToSocial
+ Copyright (C) 2021 GoToSocial Authors admin@gotosocial.org
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+*/
+
+package mastotypes
+
+type Source struct {
+}