summaryrefslogtreecommitdiff
path: root/internal/api/model
diff options
context:
space:
mode:
authorLibravatar Tobi Smethurst <31960611+tsmethurst@users.noreply.github.com>2021-05-08 14:25:55 +0200
committerLibravatar GitHub <noreply@github.com>2021-05-08 14:25:55 +0200
commit6f5c045284d34ba580d3007f70b97e05d6760527 (patch)
tree7614da22fba906361a918fb3527465b39272ac93 /internal/api/model
parentRevert "make boosts work woo (#12)" (#15) (diff)
downloadgotosocial-6f5c045284d34ba580d3007f70b97e05d6760527.tar.xz
Ap (#14)
Big restructuring and initial work on activitypub
Diffstat (limited to 'internal/api/model')
-rw-r--r--internal/api/model/account.go136
-rw-r--r--internal/api/model/activity.go31
-rw-r--r--internal/api/model/admin.go81
-rw-r--r--internal/api/model/announcement.go37
-rw-r--r--internal/api/model/announcementreaction.go33
-rw-r--r--internal/api/model/application.go55
-rw-r--r--internal/api/model/attachment.go98
-rw-r--r--internal/api/model/card.go61
-rw-r--r--internal/api/model/content.go41
-rw-r--r--internal/api/model/context.go27
-rw-r--r--internal/api/model/conversation.go36
-rw-r--r--internal/api/model/emoji.go48
-rw-r--r--internal/api/model/error.go32
-rw-r--r--internal/api/model/featuredtag.go33
-rw-r--r--internal/api/model/field.go33
-rw-r--r--internal/api/model/filter.go46
-rw-r--r--internal/api/model/history.go29
-rw-r--r--internal/api/model/identityproof.go33
-rw-r--r--internal/api/model/instance.go72
-rw-r--r--internal/api/model/list.go31
-rw-r--r--internal/api/model/marker.go37
-rw-r--r--internal/api/model/mention.go31
-rw-r--r--internal/api/model/notification.go45
-rw-r--r--internal/api/model/oauth.go37
-rw-r--r--internal/api/model/poll.go64
-rw-r--r--internal/api/model/preferences.go40
-rw-r--r--internal/api/model/pushsubscription.go45
-rw-r--r--internal/api/model/relationship.go49
-rw-r--r--internal/api/model/results.go29
-rw-r--r--internal/api/model/scheduledstatus.go39
-rw-r--r--internal/api/model/source.go41
-rw-r--r--internal/api/model/status.go138
-rw-r--r--internal/api/model/tag.go27
-rw-r--r--internal/api/model/token.go31
34 files changed, 1646 insertions, 0 deletions
diff --git a/internal/api/model/account.go b/internal/api/model/account.go
new file mode 100644
index 000000000..efb69d6fd
--- /dev/null
+++ b/internal/api/model/account.go
@@ -0,0 +1,136 @@
+/*
+ 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 <http://www.gnu.org/licenses/>.
+*/
+
+package model
+
+import (
+ "mime/multipart"
+ "net"
+)
+
+// 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,omitempty"`
+ // 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,omitempty"`
+ // When a timed mute will expire, if applicable. (ISO 8601 Datetime)
+ MuteExpiresAt string `json:"mute_expires_at,omitempty"`
+ // An extra entity to be used with API methods to verify credentials and update credentials.
+ Source *Source `json:"source,omitempty"`
+}
+
+// AccountCreateRequest represents the form submitted during a POST request to /api/v1/accounts.
+// See https://docs.joinmastodon.org/methods/accounts/
+type AccountCreateRequest struct {
+ // Text that will be reviewed by moderators if registrations require manual approval.
+ Reason string `form:"reason"`
+ // The desired username for the account
+ Username string `form:"username" binding:"required"`
+ // The email address to be used for login
+ Email string `form:"email" binding:"required"`
+ // The password to be used for login
+ Password string `form:"password" binding:"required"`
+ // Whether the user agrees to the local rules, terms, and policies.
+ // These should be presented to the user in order to allow them to consent before setting this parameter to TRUE.
+ Agreement bool `form:"agreement" binding:"required"`
+ // The language of the confirmation email that will be sent
+ Locale string `form:"locale" binding:"required"`
+ // The IP of the sign up request, will not be parsed from the form but must be added manually
+ IP net.IP `form:"-"`
+}
+
+// UpdateCredentialsRequest represents the form submitted during a PATCH request to /api/v1/accounts/update_credentials.
+// See https://docs.joinmastodon.org/methods/accounts/
+type UpdateCredentialsRequest struct {
+ // Whether the account should be shown in the profile directory.
+ Discoverable *bool `form:"discoverable"`
+ // Whether the account has a bot flag.
+ Bot *bool `form:"bot"`
+ // The display name to use for the profile.
+ DisplayName *string `form:"display_name"`
+ // The account bio.
+ Note *string `form:"note"`
+ // Avatar image encoded using multipart/form-data
+ Avatar *multipart.FileHeader `form:"avatar"`
+ // Header image encoded using multipart/form-data
+ Header *multipart.FileHeader `form:"header"`
+ // Whether manual approval of follow requests is required.
+ Locked *bool `form:"locked"`
+ // New Source values for this account
+ Source *UpdateSource `form:"source"`
+ // Profile metadata name and value
+ FieldsAttributes *[]UpdateField `form:"fields_attributes"`
+}
+
+// UpdateSource is to be used specifically in an UpdateCredentialsRequest.
+type UpdateSource struct {
+ // Default post privacy for authored statuses.
+ Privacy *string `form:"privacy"`
+ // Whether to mark authored statuses as sensitive by default.
+ Sensitive *bool `form:"sensitive"`
+ // Default language to use for authored statuses. (ISO 6391)
+ Language *string `form:"language"`
+}
+
+// UpdateField is to be used specifically in an UpdateCredentialsRequest.
+// By default, max 4 fields and 255 characters per property/value.
+type UpdateField struct {
+ // Name of the field
+ Name *string `form:"name"`
+ // Value of the field
+ Value *string `form:"value"`
+}
diff --git a/internal/api/model/activity.go b/internal/api/model/activity.go
new file mode 100644
index 000000000..c1736a8d6
--- /dev/null
+++ b/internal/api/model/activity.go
@@ -0,0 +1,31 @@
+/*
+ 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 <http://www.gnu.org/licenses/>.
+*/
+
+package model
+
+// Activity represents the mastodon-api Activity type. See here: https://docs.joinmastodon.org/entities/activity/
+type Activity struct {
+ // Midnight at the first day of the week. (UNIX Timestamp as string)
+ Week string `json:"week"`
+ // Statuses created since the week began. Integer cast to string.
+ Statuses string `json:"statuses"`
+ // User logins since the week began. Integer cast as string.
+ Logins string `json:"logins"`
+ // User registrations since the week began. Integer cast as string.
+ Registrations string `json:"registrations"`
+}
diff --git a/internal/api/model/admin.go b/internal/api/model/admin.go
new file mode 100644
index 000000000..036218f77
--- /dev/null
+++ b/internal/api/model/admin.go
@@ -0,0 +1,81 @@
+/*
+ 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 <http://www.gnu.org/licenses/>.
+*/
+
+package model
+
+// AdminAccountInfo represents the *admin* view of an account's details. See here: https://docs.joinmastodon.org/entities/admin-account/
+type AdminAccountInfo struct {
+ // The ID of the account in the database.
+ ID string `json:"id"`
+ // The username of the account.
+ Username string `json:"username"`
+ // The domain of the account.
+ Domain string `json:"domain"`
+ // When the account was first discovered. (ISO 8601 Datetime)
+ CreatedAt string `json:"created_at"`
+ // The email address associated with the account.
+ Email string `json:"email"`
+ // The IP address last used to login to this account.
+ IP string `json:"ip"`
+ // The locale of the account. (ISO 639 Part 1 two-letter language code)
+ Locale string `json:"locale"`
+ // Invite request text
+ InviteRequest string `json:"invite_request"`
+ // The current role of the account.
+ Role string `json:"role"`
+ // Whether the account has confirmed their email address.
+ Confirmed bool `json:"confirmed"`
+ // Whether the account is currently approved.
+ Approved bool `json:"approved"`
+ // Whether the account is currently disabled.
+ Disabled bool `json:"disabled"`
+ // Whether the account is currently silenced
+ Silenced bool `json:"silenced"`
+ // Whether the account is currently suspended.
+ Suspended bool `json:"suspended"`
+ // User-level information about the account.
+ Account *Account `json:"account"`
+ // The ID of the application that created this account.
+ CreatedByApplicationID string `json:"created_by_application_id,omitempty"`
+ // The ID of the account that invited this user
+ InvitedByAccountID string `json:"invited_by_account_id"`
+}
+
+// AdminReportInfo represents the *admin* view of a report. See here: https://docs.joinmastodon.org/entities/admin-report/
+type AdminReportInfo struct {
+ // The ID of the report in the database.
+ ID string `json:"id"`
+ // The action taken to resolve this report.
+ ActionTaken string `json:"action_taken"`
+ // An optional reason for reporting.
+ Comment string `json:"comment"`
+ // The time the report was filed. (ISO 8601 Datetime)
+ CreatedAt string `json:"created_at"`
+ // The time of last action on this report. (ISO 8601 Datetime)
+ UpdatedAt string `json:"updated_at"`
+ // The account which filed the report.
+ Account *Account `json:"account"`
+ // The account being reported.
+ TargetAccount *Account `json:"target_account"`
+ // The account of the moderator assigned to this report.
+ AssignedAccount *Account `json:"assigned_account"`
+ // The action taken by the moderator who handled the report.
+ ActionTakenByAccount string `json:"action_taken_by_account"`
+ // Statuses attached to the report, for context.
+ Statuses []Status `json:"statuses"`
+}
diff --git a/internal/api/model/announcement.go b/internal/api/model/announcement.go
new file mode 100644
index 000000000..eeb4b8720
--- /dev/null
+++ b/internal/api/model/announcement.go
@@ -0,0 +1,37 @@
+/*
+ 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 <http://www.gnu.org/licenses/>.
+*/
+
+package model
+
+// Announcement represents an admin/moderator announcement for local users. See here: https://docs.joinmastodon.org/entities/announcement/
+type Announcement struct {
+ ID string `json:"id"`
+ Content string `json:"content"`
+ StartsAt string `json:"starts_at"`
+ EndsAt string `json:"ends_at"`
+ AllDay bool `json:"all_day"`
+ PublishedAt string `json:"published_at"`
+ UpdatedAt string `json:"updated_at"`
+ Published bool `json:"published"`
+ Read bool `json:"read"`
+ Mentions []Mention `json:"mentions"`
+ Statuses []Status `json:"statuses"`
+ Tags []Tag `json:"tags"`
+ Emojis []Emoji `json:"emoji"`
+ Reactions []AnnouncementReaction `json:"reactions"`
+}
diff --git a/internal/api/model/announcementreaction.go b/internal/api/model/announcementreaction.go
new file mode 100644
index 000000000..81118fef0
--- /dev/null
+++ b/internal/api/model/announcementreaction.go
@@ -0,0 +1,33 @@
+/*
+ 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 <http://www.gnu.org/licenses/>.
+*/
+
+package model
+
+// AnnouncementReaction represents a user reaction to admin/moderator announcement. See here: https://docs.joinmastodon.org/entities/announcementreaction/
+type AnnouncementReaction struct {
+ // The emoji used for the reaction. Either a unicode emoji, or a custom emoji's shortcode.
+ Name string `json:"name"`
+ // The total number of users who have added this reaction.
+ Count int `json:"count"`
+ // Whether the authorized user has added this reaction to the announcement.
+ Me bool `json:"me"`
+ // A link to the custom emoji.
+ URL string `json:"url,omitempty"`
+ // A link to a non-animated version of the custom emoji.
+ StaticURL string `json:"static_url,omitempty"`
+}
diff --git a/internal/api/model/application.go b/internal/api/model/application.go
new file mode 100644
index 000000000..a796c88ea
--- /dev/null
+++ b/internal/api/model/application.go
@@ -0,0 +1,55 @@
+/*
+ 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 <http://www.gnu.org/licenses/>.
+*/
+
+package model
+
+// Application represents a mastodon-api Application, as defined here: https://docs.joinmastodon.org/entities/application/.
+// Primarily, application is used for allowing apps like Tusky etc to connect to Mastodon on behalf of a user.
+// See https://docs.joinmastodon.org/methods/apps/
+type Application struct {
+ // The application ID in the db
+ ID string `json:"id,omitempty"`
+ // The name of your application.
+ Name string `json:"name"`
+ // The website associated with your application (url)
+ Website string `json:"website,omitempty"`
+ // Where the user should be redirected after authorization.
+ RedirectURI string `json:"redirect_uri,omitempty"`
+ // ClientID to use when obtaining an oauth token for this application (ie., in client_id parameter of https://docs.joinmastodon.org/methods/apps/)
+ ClientID string `json:"client_id,omitempty"`
+ // Client secret to use when obtaining an auth token for this application (ie., in client_secret parameter of https://docs.joinmastodon.org/methods/apps/)
+ ClientSecret string `json:"client_secret,omitempty"`
+ // Used for Push Streaming API. Returned with POST /api/v1/apps. Equivalent to https://docs.joinmastodon.org/entities/pushsubscription/#server_key
+ VapidKey string `json:"vapid_key,omitempty"`
+}
+
+// ApplicationCreateRequest represents a POST request to https://example.org/api/v1/apps.
+// See here: https://docs.joinmastodon.org/methods/apps/
+// And here: https://docs.joinmastodon.org/client/token/
+type ApplicationCreateRequest struct {
+ // A name for your application
+ ClientName string `form:"client_name" binding:"required"`
+ // Where the user should be redirected after authorization.
+ // To display the authorization code to the user instead of redirecting
+ // to a web page, use urn:ietf:wg:oauth:2.0:oob in this parameter.
+ RedirectURIs string `form:"redirect_uris" binding:"required"`
+ // Space separated list of scopes. If none is provided, defaults to read.
+ Scopes string `form:"scopes"`
+ // A URL to the homepage of your app
+ Website string `form:"website"`
+}
diff --git a/internal/api/model/attachment.go b/internal/api/model/attachment.go
new file mode 100644
index 000000000..d90247f83
--- /dev/null
+++ b/internal/api/model/attachment.go
@@ -0,0 +1,98 @@
+/*
+ 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 <http://www.gnu.org/licenses/>.
+*/
+
+package model
+
+import "mime/multipart"
+
+// AttachmentRequest represents the form data parameters submitted by a client during a media upload request.
+// See: https://docs.joinmastodon.org/methods/statuses/media/
+type AttachmentRequest struct {
+ File *multipart.FileHeader `form:"file"`
+ Thumbnail *multipart.FileHeader `form:"thumbnail"`
+ Description string `form:"description"`
+ Focus string `form:"focus"`
+}
+
+// Attachment represents the object returned to a client after a successful media upload request.
+// See: https://docs.joinmastodon.org/methods/statuses/media/
+type Attachment struct {
+ // The ID of the attachment in the database.
+ ID string `json:"id"`
+ // The type of the attachment.
+ // unknown = unsupported or unrecognized file type.
+ // image = Static image.
+ // gifv = Looping, soundless animation.
+ // video = Video clip.
+ // audio = Audio track.
+ Type string `json:"type"`
+ // The location of the original full-size attachment.
+ URL string `json:"url"`
+ // The location of a scaled-down preview of the attachment.
+ PreviewURL string `json:"preview_url"`
+ // The location of the full-size original attachment on the remote server.
+ RemoteURL string `json:"remote_url,omitempty"`
+ // The location of a scaled-down preview of the attachment on the remote server.
+ PreviewRemoteURL string `json:"preview_remote_url,omitempty"`
+ // A shorter URL for the attachment.
+ TextURL string `json:"text_url,omitempty"`
+ // Metadata returned by Paperclip.
+ // May contain subtrees small and original, as well as various other top-level properties.
+ // More importantly, there may be another top-level focus Hash object as of 2.3.0, with coordinates can be used for smart thumbnail cropping.
+ // See https://docs.joinmastodon.org/methods/statuses/media/#focal-points points for more.
+ Meta MediaMeta `json:"meta,omitempty"`
+ // Alternate text that describes what is in the media attachment, to be used for the visually impaired or when media attachments do not load.
+ Description string `json:"description,omitempty"`
+ // A hash computed by the BlurHash algorithm, for generating colorful preview thumbnails when media has not been downloaded yet.
+ // See https://github.com/woltapp/blurhash
+ Blurhash string `json:"blurhash,omitempty"`
+}
+
+// MediaMeta describes the returned media
+type MediaMeta struct {
+ Length string `json:"length,omitempty"`
+ Duration float32 `json:"duration,omitempty"`
+ FPS uint16 `json:"fps,omitempty"`
+ Size string `json:"size,omitempty"`
+ Width int `json:"width,omitempty"`
+ Height int `json:"height,omitempty"`
+ Aspect float32 `json:"aspect,omitempty"`
+ AudioEncode string `json:"audio_encode,omitempty"`
+ AudioBitrate string `json:"audio_bitrate,omitempty"`
+ AudioChannels string `json:"audio_channels,omitempty"`
+ Original MediaDimensions `json:"original"`
+ Small MediaDimensions `json:"small,omitempty"`
+ Focus MediaFocus `json:"focus,omitempty"`
+}
+
+// MediaFocus describes the focal point of a piece of media. It should be returned to the caller as part of MediaMeta.
+type MediaFocus struct {
+ X float32 `json:"x"` // should be between -1 and 1
+ Y float32 `json:"y"` // should be between -1 and 1
+}
+
+// MediaDimensions describes the physical properties of a piece of media. It should be returned to the caller as part of MediaMeta.
+type MediaDimensions struct {
+ Width int `json:"width,omitempty"`
+ Height int `json:"height,omitempty"`
+ FrameRate string `json:"frame_rate,omitempty"`
+ Duration float32 `json:"duration,omitempty"`
+ Bitrate int `json:"bitrate,omitempty"`
+ Size string `json:"size,omitempty"`
+ Aspect float32 `json:"aspect,omitempty"`
+}
diff --git a/internal/api/model/card.go b/internal/api/model/card.go
new file mode 100644
index 000000000..ffa6d53e5
--- /dev/null
+++ b/internal/api/model/card.go
@@ -0,0 +1,61 @@
+/*
+ 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 <http://www.gnu.org/licenses/>.
+*/
+
+package model
+
+// 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 {
+ // REQUIRED
+
+ // Location of linked resource.
+ URL string `json:"url"`
+ // Title of linked resource.
+ Title string `json:"title"`
+ // Description of preview.
+ Description string `json:"description"`
+ // The type of the preview card.
+ // String (Enumerable, oneOf)
+ // link = Link OEmbed
+ // photo = Photo OEmbed
+ // video = Video OEmbed
+ // rich = iframe OEmbed. Not currently accepted, so won't show up in practice.
+ Type string `json:"type"`
+
+ // OPTIONAL
+
+ // The author of the original resource.
+ AuthorName string `json:"author_name"`
+ // A link to the author of the original resource.
+ AuthorURL string `json:"author_url"`
+ // The provider of the original resource.
+ ProviderName string `json:"provider_name"`
+ // A link to the provider of the original resource.
+ ProviderURL string `json:"provider_url"`
+ // HTML to be used for generating the preview card.
+ HTML string `json:"html"`
+ // Width of preview, in pixels.
+ Width int `json:"width"`
+ // Height of preview, in pixels.
+ Height int `json:"height"`
+ // Preview thumbnail.
+ Image string `json:"image"`
+ // Used for photo embeds, instead of custom html.
+ EmbedURL string `json:"embed_url"`
+ // A hash computed by the BlurHash algorithm, for generating colorful preview thumbnails when media has not been downloaded yet.
+ Blurhash string `json:"blurhash"`
+}
diff --git a/internal/api/model/content.go b/internal/api/model/content.go
new file mode 100644
index 000000000..4f004f13c
--- /dev/null
+++ b/internal/api/model/content.go
@@ -0,0 +1,41 @@
+/*
+ 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 <http://www.gnu.org/licenses/>.
+*/
+
+package model
+
+// Content wraps everything needed to serve a blob of content (some kind of media) through the API.
+type Content struct {
+ // MIME content type
+ ContentType string
+ // ContentLength in bytes
+ ContentLength int64
+ // Actual content blob
+ Content []byte
+}
+
+// GetContentRequestForm describes a piece of content desired by the caller of the fileserver API.
+type GetContentRequestForm struct {
+ // AccountID of the content owner
+ AccountID string
+ // MediaType of the content (should be convertible to a media.MediaType)
+ MediaType string
+ // MediaSize of the content (should be convertible to a media.MediaSize)
+ MediaSize string
+ // Filename of the content
+ FileName string
+}
diff --git a/internal/api/model/context.go b/internal/api/model/context.go
new file mode 100644
index 000000000..d0979319b
--- /dev/null
+++ b/internal/api/model/context.go
@@ -0,0 +1,27 @@
+/*
+ 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 <http://www.gnu.org/licenses/>.
+*/
+
+package model
+
+// Context represents the tree around a given status. Used for reconstructing threads of statuses. See: https://docs.joinmastodon.org/entities/context/
+type Context struct {
+ // Parents in the thread.
+ Ancestors []Status `json:"ancestors"`
+ // Children in the thread.
+ Descendants []Status `json:"descendants"`
+}
diff --git a/internal/api/model/conversation.go b/internal/api/model/conversation.go
new file mode 100644
index 000000000..b0568c17e
--- /dev/null
+++ b/internal/api/model/conversation.go
@@ -0,0 +1,36 @@
+/*
+ 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 <http://www.gnu.org/licenses/>.
+*/
+
+package model
+
+// Conversation represents a conversation with "direct message" visibility. See https://docs.joinmastodon.org/entities/conversation/
+type Conversation struct {
+ // REQUIRED
+
+ // Local database ID of the conversation.
+ ID string `json:"id"`
+ // Participants in the conversation.
+ Accounts []Account `json:"accounts"`
+ // Is the conversation currently marked as unread?
+ Unread bool `json:"unread"`
+
+ // OPTIONAL
+
+ // The last status in the conversation, to be used for optional display.
+ LastStatus *Status `json:"last_status"`
+}
diff --git a/internal/api/model/emoji.go b/internal/api/model/emoji.go
new file mode 100644
index 000000000..c2834718f
--- /dev/null
+++ b/internal/api/model/emoji.go
@@ -0,0 +1,48 @@
+/*
+ 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 <http://www.gnu.org/licenses/>.
+*/
+
+package model
+
+import "mime/multipart"
+
+// Emoji represents a custom emoji. See https://docs.joinmastodon.org/entities/emoji/
+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"`
+}
+
+// EmojiCreateRequest represents a request to create a custom emoji made through the admin API.
+type EmojiCreateRequest struct {
+ // Desired shortcode for the emoji, without surrounding colons. This must be unique for the domain.
+ Shortcode string `form:"shortcode" validation:"required"`
+ // Image file to use for the emoji. Must be png or gif and no larger than 50kb.
+ Image *multipart.FileHeader `form:"image" validation:"required"`
+}
diff --git a/internal/api/model/error.go b/internal/api/model/error.go
new file mode 100644
index 000000000..f145d69f2
--- /dev/null
+++ b/internal/api/model/error.go
@@ -0,0 +1,32 @@
+/*
+ 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 <http://www.gnu.org/licenses/>.
+*/
+
+package model
+
+// Error represents an error message returned from the API. See https://docs.joinmastodon.org/entities/error/
+type Error struct {
+ // REQUIRED
+
+ // The error message.
+ Error string `json:"error"`
+
+ // OPTIONAL
+
+ // A longer description of the error, mainly provided with the OAuth API.
+ ErrorDescription string `json:"error_description"`
+}
diff --git a/internal/api/model/featuredtag.go b/internal/api/model/featuredtag.go
new file mode 100644
index 000000000..3df3fe4c9
--- /dev/null
+++ b/internal/api/model/featuredtag.go
@@ -0,0 +1,33 @@
+/*
+ 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 <http://www.gnu.org/licenses/>.
+*/
+
+package model
+
+// FeaturedTag represents a hashtag that is featured on a profile. See https://docs.joinmastodon.org/entities/featuredtag/
+type FeaturedTag struct {
+ // The internal ID of the featured tag in the database.
+ ID string `json:"id"`
+ // The name of the hashtag being featured.
+ Name string `json:"name"`
+ // A link to all statuses by a user that contain this hashtag.
+ URL string `json:"url"`
+ // The number of authored statuses containing this hashtag.
+ StatusesCount int `json:"statuses_count"`
+ // The timestamp of the last authored status containing this hashtag. (ISO 8601 Datetime)
+ LastStatusAt string `json:"last_status_at"`
+}
diff --git a/internal/api/model/field.go b/internal/api/model/field.go
new file mode 100644
index 000000000..2e7662b2b
--- /dev/null
+++ b/internal/api/model/field.go
@@ -0,0 +1,33 @@
+/*
+ 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 <http://www.gnu.org/licenses/>.
+*/
+
+package model
+
+// 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"`
+}
diff --git a/internal/api/model/filter.go b/internal/api/model/filter.go
new file mode 100644
index 000000000..519922ba3
--- /dev/null
+++ b/internal/api/model/filter.go
@@ -0,0 +1,46 @@
+/*
+ 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 <http://www.gnu.org/licenses/>.
+*/
+
+package model
+
+// Filter represents a user-defined filter for determining which statuses should not be shown to the user. See https://docs.joinmastodon.org/entities/filter/
+// If whole_word is true , client app should do:
+// Define ‘word constituent character’ for your app. In the official implementation, it’s [A-Za-z0-9_] in JavaScript, and [[:word:]] in Ruby.
+// Ruby uses the POSIX character class (Letter | Mark | Decimal_Number | Connector_Punctuation).
+// If the phrase starts with a word character, and if the previous character before matched range is a word character, its matched range should be treated to not match.
+// If the phrase ends with a word character, and if the next character after matched range is a word character, its matched range should be treated to not match.
+// Please check app/javascript/mastodon/selectors/index.js and app/lib/feed_manager.rb in the Mastodon source code for more details.
+type Filter struct {
+ // The ID of the filter in the database.
+ ID string `json:"id"`
+ // The text to be filtered.
+ Phrase string `json:"text"`
+ // The contexts in which the filter should be applied.
+ // Array of String (Enumerable anyOf)
+ // home = home timeline and lists
+ // notifications = notifications timeline
+ // public = public timelines
+ // thread = expanded thread of a detailed status
+ Context []string `json:"context"`
+ // Should the filter consider word boundaries?
+ WholeWord bool `json:"whole_word"`
+ // When the filter should no longer be applied (ISO 8601 Datetime), or null if the filter does not expire
+ ExpiresAt string `json:"expires_at,omitempty"`
+ // Should matching entities in home and notifications be dropped by the server?
+ Irreversible bool `json:"irreversible"`
+}
diff --git a/internal/api/model/history.go b/internal/api/model/history.go
new file mode 100644
index 000000000..d8b4d6b4f
--- /dev/null
+++ b/internal/api/model/history.go
@@ -0,0 +1,29 @@
+/*
+ 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 <http://www.gnu.org/licenses/>.
+*/
+
+package model
+
+// History represents daily usage history of a hashtag. See https://docs.joinmastodon.org/entities/history/
+type History struct {
+ // UNIX timestamp on midnight of the given day (string cast from integer).
+ Day string `json:"day"`
+ // The counted usage of the tag within that day (string cast from integer).
+ Uses string `json:"uses"`
+ // The total of accounts using the tag within that day (string cast from integer).
+ Accounts string `json:"accounts"`
+}
diff --git a/internal/api/model/identityproof.go b/internal/api/model/identityproof.go
new file mode 100644
index 000000000..400835fca
--- /dev/null
+++ b/internal/api/model/identityproof.go
@@ -0,0 +1,33 @@
+/*
+ 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 <http://www.gnu.org/licenses/>.
+*/
+
+package model
+
+// IdentityProof represents a proof from an external identity provider. See https://docs.joinmastodon.org/entities/identityproof/
+type IdentityProof struct {
+ // The name of the identity provider.
+ Provider string `json:"provider"`
+ // The account owner's username on the identity provider's service.
+ ProviderUsername string `json:"provider_username"`
+ // The account owner's profile URL on the identity provider.
+ ProfileURL string `json:"profile_url"`
+ // A link to a statement of identity proof, hosted by the identity provider.
+ ProofURL string `json:"proof_url"`
+ // When the identity proof was last updated.
+ UpdatedAt string `json:"updated_at"`
+}
diff --git a/internal/api/model/instance.go b/internal/api/model/instance.go
new file mode 100644
index 000000000..857a8acc5
--- /dev/null
+++ b/internal/api/model/instance.go
@@ -0,0 +1,72 @@
+/*
+ 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 <http://www.gnu.org/licenses/>.
+*/
+
+package model
+
+// Instance represents the software instance of Mastodon running on this domain. See https://docs.joinmastodon.org/entities/instance/
+type Instance struct {
+ // REQUIRED
+
+ // The domain name of the instance.
+ URI string `json:"uri"`
+ // The title of the website.
+ Title string `json:"title"`
+ // Admin-defined description of the Mastodon site.
+ Description string `json:"description"`
+ // A shorter description defined by the admin.
+ ShortDescription string `json:"short_description"`
+ // An email that may be contacted for any inquiries.
+ Email string `json:"email"`
+ // The version of Mastodon installed on the instance.
+ Version string `json:"version"`
+ // Primary langauges of the website and its staff.
+ Languages []string `json:"languages"`
+ // Whether registrations are enabled.
+ Registrations bool `json:"registrations"`
+ // Whether registrations require moderator approval.
+ ApprovalRequired bool `json:"approval_required"`
+ // Whether invites are enabled.
+ InvitesEnabled bool `json:"invites_enabled"`
+ // URLs of interest for clients apps.
+ URLS *InstanceURLs `json:"urls"`
+ // Statistics about how much information the instance contains.
+ Stats *InstanceStats `json:"stats"`
+
+ // OPTIONAL
+
+ // Banner image for the website.
+ Thumbnail string `json:"thumbnail,omitempty"`
+ // A user that can be contacted, as an alternative to email.
+ ContactAccount *Account `json:"contact_account,omitempty"`
+}
+
+// InstanceURLs represents URLs necessary for successfully connecting to the instance as a user. See https://docs.joinmastodon.org/entities/instance/
+type InstanceURLs struct {
+ // Websockets address for push streaming.
+ StreamingAPI string `json:"streaming_api"`
+}
+
+// InstanceStats represents some public-facing stats about the instance. See https://docs.joinmastodon.org/entities/instance/
+type InstanceStats struct {
+ // Users registered on this instance.
+ UserCount int `json:"user_count"`
+ // Statuses authored by users on instance.
+ StatusCount int `json:"status_count"`
+ // Domains federated with this instance.
+ DomainCount int `json:"domain_count"`
+}
diff --git a/internal/api/model/list.go b/internal/api/model/list.go
new file mode 100644
index 000000000..220cde59e
--- /dev/null
+++ b/internal/api/model/list.go
@@ -0,0 +1,31 @@
+/*
+ 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 <http://www.gnu.org/licenses/>.
+*/
+
+package model
+
+// List represents a list of some users that the authenticated user follows. See https://docs.joinmastodon.org/entities/list/
+type List struct {
+ // The internal database ID of the list.
+ ID string `json:"id"`
+ // The user-defined title of the list.
+ Title string `json:"title"`
+ // followed = Show replies to any followed user
+ // list = Show replies to members of the list
+ // none = Show replies to no one
+ RepliesPolicy string `json:"replies_policy"`
+}
diff --git a/internal/api/model/marker.go b/internal/api/model/marker.go
new file mode 100644
index 000000000..1e39f1516
--- /dev/null
+++ b/internal/api/model/marker.go
@@ -0,0 +1,37 @@
+/*
+ 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 <http://www.gnu.org/licenses/>.
+*/
+
+package model
+
+// Marker represents the last read position within a user's timelines. See https://docs.joinmastodon.org/entities/marker/
+type Marker struct {
+ // Information about the user's position in the home timeline.
+ Home *TimelineMarker `json:"home"`
+ // Information about the user's position in their notifications.
+ Notifications *TimelineMarker `json:"notifications"`
+}
+
+// TimelineMarker contains information about a user's progress through a specific timeline. See https://docs.joinmastodon.org/entities/marker/
+type TimelineMarker struct {
+ // The ID of the most recently viewed entity.
+ LastReadID string `json:"last_read_id"`
+ // The timestamp of when the marker was set (ISO 8601 Datetime)
+ UpdatedAt string `json:"updated_at"`
+ // Used for locking to prevent write conflicts.
+ Version string `json:"version"`
+}
diff --git a/internal/api/model/mention.go b/internal/api/model/mention.go
new file mode 100644
index 000000000..a7985af24
--- /dev/null
+++ b/internal/api/model/mention.go
@@ -0,0 +1,31 @@
+/*
+ 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 <http://www.gnu.org/licenses/>.
+*/
+
+package model
+
+// Mention represents the mastodon-api mention type, as documented here: https://docs.joinmastodon.org/entities/mention/
+type Mention struct {
+ // The account id of the mentioned user.
+ ID string `json:"id"`
+ // The username of the mentioned user.
+ Username string `json:"username"`
+ // The location of the mentioned user's profile.
+ URL string `json:"url"`
+ // The webfinger acct: URI of the mentioned user. Equivalent to username for local users, or username@domain for remote users.
+ Acct string `json:"acct"`
+}
diff --git a/internal/api/model/notification.go b/internal/api/model/notification.go
new file mode 100644
index 000000000..c8d080e2a
--- /dev/null
+++ b/internal/api/model/notification.go
@@ -0,0 +1,45 @@
+/*
+ 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 <http://www.gnu.org/licenses/>.
+*/
+
+package model
+
+// Notification represents a notification of an event relevant to the user. See https://docs.joinmastodon.org/entities/notification/
+type Notification struct {
+ // REQUIRED
+
+ // The id of the notification in the database.
+ ID string `json:"id"`
+ // The type of event that resulted in the notification.
+ // follow = Someone followed you
+ // follow_request = Someone requested to follow you
+ // mention = Someone mentioned you in their status
+ // reblog = Someone boosted one of your statuses
+ // favourite = Someone favourited one of your statuses
+ // poll = A poll you have voted in or created has ended
+ // status = Someone you enabled notifications for has posted a status
+ Type string `json:"type"`
+ // The timestamp of the notification (ISO 8601 Datetime)
+ CreatedAt string `json:"created_at"`
+ // The account that performed the action that generated the notification.
+ Account *Account `json:"account"`
+
+ // OPTIONAL
+
+ // Status that was the object of the notification, e.g. in mentions, reblogs, favourites, or polls.
+ Status *Status `json:"status"`
+}
diff --git a/internal/api/model/oauth.go b/internal/api/model/oauth.go
new file mode 100644
index 000000000..250d2218f
--- /dev/null
+++ b/internal/api/model/oauth.go
@@ -0,0 +1,37 @@
+/*
+ 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 <http://www.gnu.org/licenses/>.
+*/
+
+package model
+
+// OAuthAuthorize represents a request sent to https://example.org/oauth/authorize
+// See here: https://docs.joinmastodon.org/methods/apps/oauth/
+type OAuthAuthorize struct {
+ // Forces the user to re-login, which is necessary for authorizing with multiple accounts from the same instance.
+ ForceLogin string `form:"force_login,omitempty"`
+ // Should be set equal to `code`.
+ ResponseType string `form:"response_type"`
+ // Client ID, obtained during app registration.
+ ClientID string `form:"client_id"`
+ // Set a URI to redirect the user to.
+ // If this parameter is set to urn:ietf:wg:oauth:2.0:oob then the authorization code will be shown instead.
+ // Must match one of the redirect URIs declared during app registration.
+ RedirectURI string `form:"redirect_uri"`
+ // List of requested OAuth scopes, separated by spaces (or by pluses, if using query parameters).
+ // Must be a subset of scopes declared during app registration. If not provided, defaults to read.
+ Scope string `form:"scope,omitempty"`
+}
diff --git a/internal/api/model/poll.go b/internal/api/model/poll.go
new file mode 100644
index 000000000..b00e7680a
--- /dev/null
+++ b/internal/api/model/poll.go
@@ -0,0 +1,64 @@
+/*
+ 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 <http://www.gnu.org/licenses/>.
+*/
+
+package model
+
+// 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://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"`
+ // Duration the poll should be open, in seconds. If provided, media_ids cannot be used, and poll[options] must be provided.
+ ExpiresIn int `form:"expires_in"`
+ // Allow multiple choices?
+ Multiple bool `form:"multiple"`
+ // Hide vote counts until the poll ends?
+ HideTotals bool `form:"hide_totals"`
+}
diff --git a/internal/api/model/preferences.go b/internal/api/model/preferences.go
new file mode 100644
index 000000000..9e410091e
--- /dev/null
+++ b/internal/api/model/preferences.go
@@ -0,0 +1,40 @@
+/*
+ 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 <http://www.gnu.org/licenses/>.
+*/
+
+package model
+
+// Preferences represents a user's preferences. See https://docs.joinmastodon.org/entities/preferences/
+type Preferences struct {
+ // Default visibility for new posts.
+ // public = Public post
+ // unlisted = Unlisted post
+ // private = Followers-only post
+ // direct = Direct post
+ PostingDefaultVisibility string `json:"posting:default:visibility"`
+ // Default sensitivity flag for new posts.
+ PostingDefaultSensitive bool `json:"posting:default:sensitive"`
+ // Default language for new posts. (ISO 639-1 language two-letter code), or null
+ PostingDefaultLanguage string `json:"posting:default:language,omitempty"`
+ // Whether media attachments should be automatically displayed or blurred/hidden.
+ // default = Hide media marked as sensitive
+ // show_all = Always show all media by default, regardless of sensitivity
+ // hide_all = Always hide all media by default, regardless of sensitivity
+ ReadingExpandMedia string `json:"reading:expand:media"`
+ // Whether CWs should be expanded by default.
+ ReadingExpandSpoilers bool `json:"reading:expand:spoilers"`
+}
diff --git a/internal/api/model/pushsubscription.go b/internal/api/model/pushsubscription.go
new file mode 100644
index 000000000..f34c63374
--- /dev/null
+++ b/internal/api/model/pushsubscription.go
@@ -0,0 +1,45 @@
+/*
+ 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 <http://www.gnu.org/licenses/>.
+*/
+
+package model
+
+// PushSubscription represents a subscription to the push streaming server. See https://docs.joinmastodon.org/entities/pushsubscription/
+type PushSubscription struct {
+ // The id of the push subscription in the database.
+ ID string `json:"id"`
+ // Where push alerts will be sent to.
+ Endpoint string `json:"endpoint"`
+ // The streaming server's VAPID key.
+ ServerKey string `json:"server_key"`
+ // Which alerts should be delivered to the endpoint.
+ Alerts *PushSubscriptionAlerts `json:"alerts"`
+}
+
+// PushSubscriptionAlerts represents the specific alerts that this push subscription will give.
+type PushSubscriptionAlerts struct {
+ // Receive a push notification when someone has followed you?
+ Follow bool `json:"follow"`
+ // Receive a push notification when a status you created has been favourited by someone else?
+ Favourite bool `json:"favourite"`
+ // Receive a push notification when someone else has mentioned you in a status?
+ Mention bool `json:"mention"`
+ // Receive a push notification when a status you created has been boosted by someone else?
+ Reblog bool `json:"reblog"`
+ // Receive a push notification when a poll you voted in or created has ended?
+ Poll bool `json:"poll"`
+}
diff --git a/internal/api/model/relationship.go b/internal/api/model/relationship.go
new file mode 100644
index 000000000..6e71023e2
--- /dev/null
+++ b/internal/api/model/relationship.go
@@ -0,0 +1,49 @@
+/*
+ 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 <http://www.gnu.org/licenses/>.
+*/
+
+package model
+
+// Relationship represents a relationship between accounts. See https://docs.joinmastodon.org/entities/relationship/
+type Relationship struct {
+ // The account id.
+ ID string `json:"id"`
+ // Are you following this user?
+ Following bool `json:"following"`
+ // Are you receiving this user's boosts in your home timeline?
+ ShowingReblogs bool `json:"showing_reblogs"`
+ // Have you enabled notifications for this user?
+ Notifying bool `json:"notifying"`
+ // Are you followed by this user?
+ FollowedBy bool `json:"followed_by"`
+ // Are you blocking this user?
+ Blocking bool `json:"blocking"`
+ // Is this user blocking you?
+ BlockedBy bool `json:"blocked_by"`
+ // Are you muting this user?
+ Muting bool `json:"muting"`
+ // Are you muting notifications from this user?
+ MutingNotifications bool `json:"muting_notifications"`
+ // Do you have a pending follow request for this user?
+ Requested bool `json:"requested"`
+ // Are you blocking this user's domain?
+ DomainBlocking bool `json:"domain_blocking"`
+ // Are you featuring this user on your profile?
+ Endorsed bool `json:"endorsed"`
+ // Your note on this account.
+ Note string `json:"note"`
+}
diff --git a/internal/api/model/results.go b/internal/api/model/results.go
new file mode 100644
index 000000000..1b2625a0d
--- /dev/null
+++ b/internal/api/model/results.go
@@ -0,0 +1,29 @@
+/*
+ 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 <http://www.gnu.org/licenses/>.
+*/
+
+package model
+
+// Results represents the results of a search. See https://docs.joinmastodon.org/entities/results/
+type Results struct {
+ // Accounts which match the given query
+ Accounts []Account `json:"accounts"`
+ // Statuses which match the given query
+ Statuses []Status `json:"statuses"`
+ // Hashtags which match the given query
+ Hashtags []Tag `json:"hashtags"`
+}
diff --git a/internal/api/model/scheduledstatus.go b/internal/api/model/scheduledstatus.go
new file mode 100644
index 000000000..deafd22aa
--- /dev/null
+++ b/internal/api/model/scheduledstatus.go
@@ -0,0 +1,39 @@
+/*
+ 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 <http://www.gnu.org/licenses/>.
+*/
+
+package model
+
+// ScheduledStatus represents a status that will be published at a future scheduled date. See https://docs.joinmastodon.org/entities/scheduledstatus/
+type ScheduledStatus struct {
+ ID string `json:"id"`
+ ScheduledAt string `json:"scheduled_at"`
+ Params *StatusParams `json:"params"`
+ MediaAttachments []Attachment `json:"media_attachments"`
+}
+
+// StatusParams represents parameters for a scheduled status. See https://docs.joinmastodon.org/entities/scheduledstatus/
+type StatusParams struct {
+ Text string `json:"text"`
+ InReplyToID string `json:"in_reply_to_id,omitempty"`
+ MediaIDs []string `json:"media_ids,omitempty"`
+ Sensitive bool `json:"sensitive,omitempty"`
+ SpoilerText string `json:"spoiler_text,omitempty"`
+ Visibility string `json:"visibility"`
+ ScheduledAt string `json:"scheduled_at,omitempty"`
+ ApplicationID string `json:"application_id"`
+}
diff --git a/internal/api/model/source.go b/internal/api/model/source.go
new file mode 100644
index 000000000..441af71de
--- /dev/null
+++ b/internal/api/model/source.go
@@ -0,0 +1,41 @@
+/*
+ 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 <http://www.gnu.org/licenses/>.
+*/
+
+package model
+
+// Source represents display or publishing preferences of user's own account.
+// Returned as an additional entity when verifying and updated credentials, as an attribute of Account.
+// See https://docs.joinmastodon.org/entities/source/
+type Source struct {
+ // The default post privacy to be used for new statuses.
+ // public = Public post
+ // unlisted = Unlisted post
+ // private = Followers-only post
+ // direct = Direct post
+ Privacy Visibility `json:"privacy,omitempty"`
+ // Whether new statuses should be marked sensitive by default.
+ Sensitive bool `json:"sensitive,omitempty"`
+ // The default posting language for new statuses.
+ Language string `json:"language,omitempty"`
+ // Profile bio.
+ Note string `json:"note"`
+ // Metadata about the account.
+ Fields []Field `json:"fields"`
+ // The number of pending follow requests.
+ FollowRequestsCount int `json:"follow_requests_count,omitempty"`
+}
diff --git a/internal/api/model/status.go b/internal/api/model/status.go
new file mode 100644
index 000000000..faf88ae84
--- /dev/null
+++ b/internal/api/model/status.go
@@ -0,0 +1,138 @@
+/*
+ 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 <http://www.gnu.org/licenses/>.
+*/
+
+package model
+
+// Status represents a mastodon-api Status type, as defined here: https://docs.joinmastodon.org/entities/status/
+type Status struct {
+ // ID of the status in the database.
+ ID string `json:"id"`
+ // The date when this status was created (ISO 8601 Datetime)
+ CreatedAt string `json:"created_at"`
+ // ID of the status being replied.
+ InReplyToID string `json:"in_reply_to_id,omitempty"`
+ // ID of the account being replied to.
+ InReplyToAccountID string `json:"in_reply_to_account_id,omitempty"`
+ // Is this status marked as sensitive content?
+ Sensitive bool `json:"sensitive"`
+ // Subject or summary line, below which status content is collapsed until expanded.
+ SpoilerText string `json:"spoiler_text,omitempty"`
+ // Visibility of this status.
+ Visibility Visibility `json:"visibility"`
+ // Primary language of this status. (ISO 639 Part 1 two-letter language code)
+ Language string `json:"language"`
+ // URI of the status used for federation.
+ URI string `json:"uri"`
+ // A link to the status's HTML representation.
+ URL string `json:"url"`
+ // How many replies this status has received.
+ RepliesCount int `json:"replies_count"`
+ // How many boosts this status has received.
+ ReblogsCount int `json:"reblogs_count"`
+ // How many favourites this status has received.
+ FavouritesCount int `json:"favourites_count"`
+ // Have you favourited this status?
+ Favourited bool `json:"favourited"`
+ // Have you boosted this status?
+ Reblogged bool `json:"reblogged"`
+ // Have you muted notifications for this status's conversation?
+ Muted bool `json:"muted"`
+ // Have you bookmarked this status?
+ Bookmarked bool `json:"bookmarked"`
+ // Have you pinned this status? Only appears if the status is pinnable.
+ Pinned bool `json:"pinned"`
+ // HTML-encoded status content.
+ Content string `json:"content"`
+ // The status being reblogged.
+ Reblog *Status `json:"reblog,omitempty"`
+ // The application used to post this status.
+ Application *Application `json:"application"`
+ // The account that authored this status.
+ Account *Account `json:"account"`
+ // Media that is attached to this status.
+ MediaAttachments []Attachment `json:"media_attachments"`
+ // Mentions of users within the status content.
+ Mentions []Mention `json:"mentions"`
+ // Hashtags used within the status content.
+ Tags []Tag `json:"tags"`
+ // Custom emoji to be used when rendering status content.
+ Emojis []Emoji `json:"emojis"`
+ // Preview card for links included within status content.
+ Card *Card `json:"card"`
+ // The poll attached to the status.
+ Poll *Poll `json:"poll"`
+ // Plain-text source of a status. Returned instead of content when status is deleted,
+ // so the user may redraft from the source text without the client having to reverse-engineer
+ // the original text from the HTML content.
+ Text string `json:"text"`
+}
+
+// StatusCreateRequest represents a mastodon-api 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
+type StatusCreateRequest struct {
+ // Text content of the status. If media_ids is provided, this becomes optional. Attaching a poll is optional while status is provided.
+ Status string `form:"status"`
+ // Array of Attachment ids to be attached as media. If provided, status becomes optional, and poll cannot be used.
+ MediaIDs []string `form:"media_ids"`
+ // Poll to include with this status.
+ Poll *PollRequest `form:"poll"`
+ // ID of the status being replied to, if status is a reply
+ InReplyToID string `form:"in_reply_to_id"`
+ // Mark status and attached media as sensitive?
+ Sensitive bool `form:"sensitive"`
+ // Text to be shown as a warning or subject before the actual content. Statuses are generally collapsed behind this field.
+ SpoilerText string `form:"spoiler_text"`
+ // Visibility of the posted status. Enumerable oneOf public, unlisted, private, direct.
+ Visibility Visibility `form:"visibility"`
+ // ISO 8601 Datetime at which to schedule a status. Providing this paramter will cause ScheduledStatus to be returned instead of Status. Must be at least 5 minutes in the future.
+ ScheduledAt string `form:"scheduled_at"`
+ // ISO 639 language code for this status.
+ Language string `form:"language"`
+}
+
+// Visibility denotes the visibility of this status to other users
+type Visibility string
+
+const (
+ // VisibilityPublic means visible to everyone
+ VisibilityPublic Visibility = "public"
+ // VisibilityUnlisted means visible to everyone but only on home timelines or in lists
+ VisibilityUnlisted Visibility = "unlisted"
+ // VisibilityPrivate means visible to followers only
+ VisibilityPrivate Visibility = "private"
+ // VisibilityDirect means visible only to tagged recipients
+ VisibilityDirect Visibility = "direct"
+)
+
+type AdvancedStatusCreateForm struct {
+ StatusCreateRequest
+ AdvancedVisibilityFlagsForm
+}
+
+type AdvancedVisibilityFlagsForm struct {
+ // The gotosocial visibility model
+ VisibilityAdvanced *string `form:"visibility_advanced"`
+ // This status will be federated beyond the local timeline(s)
+ Federated *bool `form:"federated"`
+ // This status can be boosted/reblogged
+ Boostable *bool `form:"boostable"`
+ // This status can be replied to
+ Replyable *bool `form:"replyable"`
+ // This status can be liked/faved
+ Likeable *bool `form:"likeable"`
+}
diff --git a/internal/api/model/tag.go b/internal/api/model/tag.go
new file mode 100644
index 000000000..f009b4cef
--- /dev/null
+++ b/internal/api/model/tag.go
@@ -0,0 +1,27 @@
+/*
+ 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 <http://www.gnu.org/licenses/>.
+*/
+
+package model
+
+// Tag represents a hashtag used within the content of a status. See https://docs.joinmastodon.org/entities/tag/
+type Tag struct {
+ // The value of the hashtag after the # sign.
+ Name string `json:"name"`
+ // A link to the hashtag on the instance.
+ URL string `json:"url"`
+}
diff --git a/internal/api/model/token.go b/internal/api/model/token.go
new file mode 100644
index 000000000..611ab214c
--- /dev/null
+++ b/internal/api/model/token.go
@@ -0,0 +1,31 @@
+/*
+ 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 <http://www.gnu.org/licenses/>.
+*/
+
+package model
+
+// Token represents an OAuth token used for authenticating with the API and performing actions.. See https://docs.joinmastodon.org/entities/token/
+type Token struct {
+ // An OAuth token to be used for authorization.
+ AccessToken string `json:"access_token"`
+ // The OAuth token type. Mastodon uses Bearer tokens.
+ TokenType string `json:"token_type"`
+ // The OAuth scopes granted by this token, space-separated.
+ Scope string `json:"scope"`
+ // When the token was generated. (UNIX timestamp seconds)
+ CreatedAt int64 `json:"created_at"`
+}