2021-03-11 14:30:14 +01:00
|
|
|
/*
|
|
|
|
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/>.
|
|
|
|
*/
|
|
|
|
|
2021-05-08 14:25:55 +02:00
|
|
|
package model
|
2021-03-11 14:30:14 +01:00
|
|
|
|
2021-08-02 19:06:44 +02:00
|
|
|
// Status models a status or post.
|
2021-07-31 17:49:59 +02:00
|
|
|
//
|
|
|
|
// swagger:model status
|
2021-03-11 14:30:14 +01:00
|
|
|
type Status struct {
|
2021-07-31 17:49:59 +02:00
|
|
|
// ID of the status.
|
|
|
|
// example: 01FBVD42CQ3ZEEVMW180SBX03B
|
2021-03-11 14:30:14 +01:00
|
|
|
ID string `json:"id"`
|
2021-07-31 17:49:59 +02:00
|
|
|
// The date when this status was created (ISO 8601 Datetime).
|
|
|
|
// example: 2021-07-30T09:20:25+00:00
|
2021-03-11 14:30:14 +01:00
|
|
|
CreatedAt string `json:"created_at"`
|
2021-07-31 17:49:59 +02:00
|
|
|
// ID of the status being replied to.
|
|
|
|
// example: 01FBVD42CQ3ZEEVMW180SBX03B
|
2021-04-19 19:42:19 +02:00
|
|
|
InReplyToID string `json:"in_reply_to_id,omitempty"`
|
2021-03-11 14:30:14 +01:00
|
|
|
// ID of the account being replied to.
|
2021-07-31 17:49:59 +02:00
|
|
|
// example: 01FBVD42CQ3ZEEVMW180SBX03B
|
2021-04-19 19:42:19 +02:00
|
|
|
InReplyToAccountID string `json:"in_reply_to_account_id,omitempty"`
|
2021-07-31 17:49:59 +02:00
|
|
|
// Status contains sensitive content.
|
|
|
|
// example: false
|
2021-03-11 14:30:14 +01:00
|
|
|
Sensitive bool `json:"sensitive"`
|
2021-07-31 17:49:59 +02:00
|
|
|
// Subject, summary, or content warning for the status.
|
|
|
|
// example: warning nsfw
|
2021-05-27 16:06:24 +02:00
|
|
|
SpoilerText string `json:"spoiler_text"`
|
2021-03-11 14:30:14 +01:00
|
|
|
// Visibility of this status.
|
2021-07-31 17:49:59 +02:00
|
|
|
// example: unlisted
|
2021-04-19 19:42:19 +02:00
|
|
|
Visibility Visibility `json:"visibility"`
|
2021-07-31 17:49:59 +02:00
|
|
|
// Primary language of this status (ISO 639 Part 1 two-letter language code).
|
|
|
|
// example: en
|
2021-03-11 14:30:14 +01:00
|
|
|
Language string `json:"language"`
|
2021-07-31 17:49:59 +02:00
|
|
|
// ActivityPub URI of the status. Equivalent to the status's activitypub ID.
|
|
|
|
// example: https://example.org/users/some_user/statuses/01FBVD42CQ3ZEEVMW180SBX03B
|
2021-03-11 14:30:14 +01:00
|
|
|
URI string `json:"uri"`
|
2021-07-31 17:49:59 +02:00
|
|
|
// The status's publicly available web URL. This link will only work if the visibility of the status is 'public'.
|
|
|
|
// example: https://example.org/@some_user/statuses/01FBVD42CQ3ZEEVMW180SBX03B
|
2021-03-11 14:30:14 +01:00
|
|
|
URL string `json:"url"`
|
2021-07-31 17:49:59 +02:00
|
|
|
// Number of replies to this status, according to our instance.
|
2021-03-11 14:30:14 +01:00
|
|
|
RepliesCount int `json:"replies_count"`
|
2021-07-31 17:49:59 +02:00
|
|
|
// Number of times this status has been boosted/reblogged, according to our instance.
|
2021-03-11 14:30:14 +01:00
|
|
|
ReblogsCount int `json:"reblogs_count"`
|
2021-07-31 17:49:59 +02:00
|
|
|
// Number of favourites/likes this status has received, according to our instance.
|
2021-03-11 14:30:14 +01:00
|
|
|
FavouritesCount int `json:"favourites_count"`
|
2021-07-31 17:49:59 +02:00
|
|
|
// This status has been favourited by the account viewing it.
|
2021-03-11 14:30:14 +01:00
|
|
|
Favourited bool `json:"favourited"`
|
2021-07-31 17:49:59 +02:00
|
|
|
// This status has been boosted/reblogged by the account viewing it.
|
2021-03-11 14:30:14 +01:00
|
|
|
Reblogged bool `json:"reblogged"`
|
2021-07-31 17:49:59 +02:00
|
|
|
// Replies to this status have been muted by the account viewing it.
|
2021-03-11 14:30:14 +01:00
|
|
|
Muted bool `json:"muted"`
|
2021-07-31 17:49:59 +02:00
|
|
|
// This status has been bookmarked by the account viewing it.
|
2021-03-11 14:30:14 +01:00
|
|
|
Bookmarked bool `json:"bookmarked"`
|
2021-07-31 17:49:59 +02:00
|
|
|
// This status has been pinned by the account viewing it (only relevant for your own statuses).
|
2021-05-17 19:06:58 +02:00
|
|
|
Pinned bool `json:"pinned,omitempty"`
|
2021-07-31 17:49:59 +02:00
|
|
|
// The content of this status. Should be HTML, but might also be plaintext in some cases.
|
|
|
|
// example: <p>Hey this is a status!</p>
|
2021-03-11 14:30:14 +01:00
|
|
|
Content string `json:"content"`
|
2021-08-02 19:06:44 +02:00
|
|
|
// The status that this status reblogs/boosts.
|
|
|
|
// nullable: true
|
|
|
|
Reblog *StatusReblogged `json:"reblog,omitempty"`
|
2021-07-31 17:49:59 +02:00
|
|
|
// The application used to post this status, if visible.
|
2021-03-11 14:30:14 +01:00
|
|
|
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"`
|
|
|
|
}
|
2021-04-19 19:42:19 +02:00
|
|
|
|
2021-08-02 19:06:44 +02:00
|
|
|
// StatusReblogged represents a reblogged status.
|
|
|
|
//
|
|
|
|
// swagger:model statusReblogged
|
|
|
|
type StatusReblogged struct {
|
|
|
|
*Status
|
|
|
|
}
|
|
|
|
|
|
|
|
// StatusCreateRequest models status creation parameters.
|
|
|
|
//
|
|
|
|
// swagger:parameters statusCreate
|
2021-04-19 19:42:19 +02:00
|
|
|
type StatusCreateRequest struct {
|
2021-08-02 19:06:44 +02:00
|
|
|
// Text content of the status.
|
|
|
|
// If media_ids is provided, this becomes optional.
|
|
|
|
// Attaching a poll is optional while status is provided.
|
|
|
|
// in: formData
|
2021-05-17 19:06:58 +02:00
|
|
|
Status string `form:"status" json:"status" xml:"status"`
|
2021-08-02 19:06:44 +02:00
|
|
|
// Array of Attachment ids to be attached as media.
|
|
|
|
// If provided, status becomes optional, and poll cannot be used.
|
|
|
|
// in: formData
|
2021-05-10 16:29:05 +02:00
|
|
|
MediaIDs []string `form:"media_ids" json:"media_ids" xml:"media_ids"`
|
2021-04-19 19:42:19 +02:00
|
|
|
// Poll to include with this status.
|
2021-08-02 19:06:44 +02:00
|
|
|
// swagger:ignore
|
2021-05-17 19:06:58 +02:00
|
|
|
Poll *PollRequest `form:"poll" json:"poll" xml:"poll"`
|
2021-08-02 19:06:44 +02:00
|
|
|
// ID of the status being replied to, if status is a reply.
|
|
|
|
// in: formData
|
2021-05-17 19:06:58 +02:00
|
|
|
InReplyToID string `form:"in_reply_to_id" json:"in_reply_to_id" xml:"in_reply_to_id"`
|
2021-08-02 19:06:44 +02:00
|
|
|
// Status and attached media should be marked as sensitive.
|
|
|
|
// in: formData
|
2021-05-17 19:06:58 +02:00
|
|
|
Sensitive bool `form:"sensitive" json:"sensitive" xml:"sensitive"`
|
2021-08-02 19:06:44 +02:00
|
|
|
// Text to be shown as a warning or subject before the actual content.
|
|
|
|
// Statuses are generally collapsed behind this field.
|
|
|
|
// in: formData
|
2021-05-17 19:06:58 +02:00
|
|
|
SpoilerText string `form:"spoiler_text" json:"spoiler_text" xml:"spoiler_text"`
|
2021-08-02 19:06:44 +02:00
|
|
|
// Visibility of the posted status.
|
|
|
|
// enum:
|
|
|
|
// - public
|
|
|
|
// - unlisted
|
|
|
|
// - private
|
|
|
|
// - direct
|
|
|
|
// in: formData
|
2021-05-17 19:06:58 +02:00
|
|
|
Visibility Visibility `form:"visibility" json:"visibility" xml:"visibility"`
|
2021-08-02 19:06:44 +02:00
|
|
|
// 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.
|
|
|
|
// in: formData
|
2021-05-17 19:06:58 +02:00
|
|
|
ScheduledAt string `form:"scheduled_at" json:"scheduled_at" xml:"scheduled_at"`
|
2021-04-19 19:42:19 +02:00
|
|
|
// ISO 639 language code for this status.
|
2021-08-02 19:06:44 +02:00
|
|
|
// in: formData
|
2021-05-17 19:06:58 +02:00
|
|
|
Language string `form:"language" json:"language" xml:"language"`
|
2021-08-02 19:06:44 +02:00
|
|
|
// Format to use when parsing this status.
|
|
|
|
// enum:
|
|
|
|
// - markdown
|
|
|
|
// - plain
|
|
|
|
// in: formData
|
2021-07-26 20:25:54 +02:00
|
|
|
Format StatusFormat `form:"format" json:"format" xml:"format"`
|
2021-04-19 19:42:19 +02:00
|
|
|
}
|
|
|
|
|
2021-08-02 19:06:44 +02:00
|
|
|
// Visibility models the visibility of a status.
|
2021-07-31 17:49:59 +02:00
|
|
|
//
|
|
|
|
// swagger:model statusVisibility
|
2021-08-02 19:06:44 +02:00
|
|
|
// enum:
|
|
|
|
// - public
|
|
|
|
// - unlisted
|
|
|
|
// - private
|
|
|
|
// - direct
|
2021-04-19 19:42:19 +02:00
|
|
|
type Visibility string
|
|
|
|
|
|
|
|
const (
|
2021-07-31 17:49:59 +02:00
|
|
|
// VisibilityPublic is visible to everyone, and will be available via the web even for nonauthenticated users.
|
2021-04-19 19:42:19 +02:00
|
|
|
VisibilityPublic Visibility = "public"
|
2021-07-31 17:49:59 +02:00
|
|
|
// VisibilityUnlisted is visible to everyone, but only on home timelines, lists, etc.
|
2021-04-19 19:42:19 +02:00
|
|
|
VisibilityUnlisted Visibility = "unlisted"
|
2021-07-31 17:49:59 +02:00
|
|
|
// VisibilityPrivate is visible only to followers of the account that posted the status.
|
2021-04-19 19:42:19 +02:00
|
|
|
VisibilityPrivate Visibility = "private"
|
2021-07-31 17:49:59 +02:00
|
|
|
// VisibilityMutualsOnly is visible only to mutual followers of the account that posted the status.
|
|
|
|
VisibilityMutualsOnly Visibility = "mutuals_only"
|
|
|
|
// VisibilityDirect is visible only to accounts tagged in the status. It is equivalent to a direct message.
|
2021-04-19 19:42:19 +02:00
|
|
|
VisibilityDirect Visibility = "direct"
|
|
|
|
)
|
2021-05-08 14:25:55 +02:00
|
|
|
|
2021-05-15 11:58:11 +02:00
|
|
|
// AdvancedStatusCreateForm wraps the mastodon status create form along with the GTS advanced
|
|
|
|
// visibility settings.
|
2021-08-02 19:06:44 +02:00
|
|
|
//
|
|
|
|
// swagger:model advancedStatusCreateForm
|
2021-05-08 14:25:55 +02:00
|
|
|
type AdvancedStatusCreateForm struct {
|
|
|
|
StatusCreateRequest
|
|
|
|
AdvancedVisibilityFlagsForm
|
|
|
|
}
|
|
|
|
|
2021-05-15 11:58:11 +02:00
|
|
|
// AdvancedVisibilityFlagsForm allows a few more advanced flags to be set on new statuses, in addition
|
|
|
|
// to the standard mastodon-compatible ones.
|
2021-08-02 19:06:44 +02:00
|
|
|
//
|
|
|
|
// swagger:model advancedVisibilityFlagsForm
|
2021-05-08 14:25:55 +02:00
|
|
|
type AdvancedVisibilityFlagsForm struct {
|
2021-08-02 19:06:44 +02:00
|
|
|
// This status will be federated beyond the local timeline(s).
|
2021-05-17 19:06:58 +02:00
|
|
|
Federated *bool `form:"federated" json:"federated" xml:"federated"`
|
2021-08-02 19:06:44 +02:00
|
|
|
// This status can be boosted/reblogged.
|
2021-05-17 19:06:58 +02:00
|
|
|
Boostable *bool `form:"boostable" json:"boostable" xml:"boostable"`
|
2021-08-02 19:06:44 +02:00
|
|
|
// This status can be replied to.
|
2021-05-17 19:06:58 +02:00
|
|
|
Replyable *bool `form:"replyable" json:"replyable" xml:"replyable"`
|
2021-08-02 19:06:44 +02:00
|
|
|
// This status can be liked/faved.
|
2021-05-17 19:06:58 +02:00
|
|
|
Likeable *bool `form:"likeable" json:"likeable" xml:"likeable"`
|
2021-05-08 14:25:55 +02:00
|
|
|
}
|
2021-07-26 20:25:54 +02:00
|
|
|
|
2021-08-02 19:06:44 +02:00
|
|
|
// StatusFormat is the format in which to parse the submitted status.
|
|
|
|
// Can be either plain or markdown. Empty will default to plain.
|
|
|
|
//
|
|
|
|
// swagger:model statusFormat
|
|
|
|
// enum:
|
|
|
|
// - plain
|
|
|
|
// - markdown
|
|
|
|
// example: plain
|
2021-07-26 20:25:54 +02:00
|
|
|
type StatusFormat string
|
|
|
|
|
|
|
|
// StatusFormatPlain expects a plaintext status which will then be formatted into html.
|
|
|
|
const StatusFormatPlain StatusFormat = "plain"
|
|
|
|
|
|
|
|
// StatusFormatMarkdown expects a markdown formatted status, which will then be formatted into html.
|
|
|
|
const StatusFormatMarkdown StatusFormat = "markdown"
|
|
|
|
|
|
|
|
// StatusFormatDefault is the format that should be used when nothing else is specified.
|
|
|
|
const StatusFormatDefault StatusFormat = StatusFormatPlain
|