diff options
Diffstat (limited to 'pkg/mastotypes')
34 files changed, 0 insertions, 1561 deletions
diff --git a/pkg/mastotypes/README.md b/pkg/mastotypes/README.md deleted file mode 100644 index 38f9e89c4..000000000 --- a/pkg/mastotypes/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Mastotypes - -This package contains Go types/structs for Mastodon's REST API. - -See [here](https://docs.joinmastodon.org/methods/apps/). diff --git a/pkg/mastotypes/account.go b/pkg/mastotypes/account.go deleted file mode 100644 index 3ddd3c517..000000000 --- a/pkg/mastotypes/account.go +++ /dev/null @@ -1,131 +0,0 @@ -/* - 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 mastotypes - -import "mime/multipart" - -// 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"` -} - -// 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"` -} - -// 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/pkg/mastotypes/activity.go b/pkg/mastotypes/activity.go deleted file mode 100644 index b8dbf2c1b..000000000 --- a/pkg/mastotypes/activity.go +++ /dev/null @@ -1,31 +0,0 @@ -/* - 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 mastotypes - -// 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/pkg/mastotypes/admin.go b/pkg/mastotypes/admin.go deleted file mode 100644 index 71c2bb309..000000000 --- a/pkg/mastotypes/admin.go +++ /dev/null @@ -1,81 +0,0 @@ -/* - 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 mastotypes - -// 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/pkg/mastotypes/announcement.go b/pkg/mastotypes/announcement.go deleted file mode 100644 index 882d6bb9b..000000000 --- a/pkg/mastotypes/announcement.go +++ /dev/null @@ -1,37 +0,0 @@ -/* - 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 mastotypes - -// 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/pkg/mastotypes/announcementreaction.go b/pkg/mastotypes/announcementreaction.go deleted file mode 100644 index 444c57e2c..000000000 --- a/pkg/mastotypes/announcementreaction.go +++ /dev/null @@ -1,33 +0,0 @@ -/* - 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 mastotypes - -// 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/pkg/mastotypes/application.go b/pkg/mastotypes/application.go deleted file mode 100644 index 1984eff46..000000000 --- a/pkg/mastotypes/application.go +++ /dev/null @@ -1,55 +0,0 @@ -/* - 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 mastotypes - -// 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"` -} - -// ApplicationPOSTRequest 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 ApplicationPOSTRequest 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/pkg/mastotypes/attachment.go b/pkg/mastotypes/attachment.go deleted file mode 100644 index 4d4d0955a..000000000 --- a/pkg/mastotypes/attachment.go +++ /dev/null @@ -1,96 +0,0 @@ -/* - 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 mastotypes - -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 website. - RemoteURL string `json:"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/pkg/mastotypes/card.go b/pkg/mastotypes/card.go deleted file mode 100644 index d1147e04b..000000000 --- a/pkg/mastotypes/card.go +++ /dev/null @@ -1,61 +0,0 @@ -/* - 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 mastotypes - -// Card represents a rich preview card that is generated using OpenGraph tags from a URL. See here: https://docs.joinmastodon.org/entities/card/ -type Card struct { - // 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/pkg/mastotypes/context.go b/pkg/mastotypes/context.go deleted file mode 100644 index 397522dc7..000000000 --- a/pkg/mastotypes/context.go +++ /dev/null @@ -1,27 +0,0 @@ -/* - 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 mastotypes - -// 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/pkg/mastotypes/conversation.go b/pkg/mastotypes/conversation.go deleted file mode 100644 index ed95c124c..000000000 --- a/pkg/mastotypes/conversation.go +++ /dev/null @@ -1,36 +0,0 @@ -/* - 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 mastotypes - -// 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/pkg/mastotypes/emoji.go b/pkg/mastotypes/emoji.go deleted file mode 100644 index e9ef95460..000000000 --- a/pkg/mastotypes/emoji.go +++ /dev/null @@ -1,38 +0,0 @@ -/* - 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 mastotypes - -// 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"` -} diff --git a/pkg/mastotypes/error.go b/pkg/mastotypes/error.go deleted file mode 100644 index 394085724..000000000 --- a/pkg/mastotypes/error.go +++ /dev/null @@ -1,32 +0,0 @@ -/* - 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 mastotypes - -// 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/pkg/mastotypes/featuredtag.go b/pkg/mastotypes/featuredtag.go deleted file mode 100644 index 0e0bbe802..000000000 --- a/pkg/mastotypes/featuredtag.go +++ /dev/null @@ -1,33 +0,0 @@ -/* - 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 mastotypes - -// 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/pkg/mastotypes/field.go b/pkg/mastotypes/field.go deleted file mode 100644 index 29b5a1803..000000000 --- a/pkg/mastotypes/field.go +++ /dev/null @@ -1,33 +0,0 @@ -/* - 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 mastotypes - -// Field represents a profile field as a name-value pair with optional verification. See https://docs.joinmastodon.org/entities/field/ -type Field struct { - // REQUIRED - - // The key of a given field's key-value pair. - Name string `json:"name"` - // The value associated with the name key. - Value string `json:"value"` - - // OPTIONAL - // Timestamp of when the server verified a URL value for a rel="me” link. String (ISO 8601 Datetime) if value is a verified URL - VerifiedAt string `json:"verified_at,omitempty"` -} diff --git a/pkg/mastotypes/filter.go b/pkg/mastotypes/filter.go deleted file mode 100644 index 86d9795a3..000000000 --- a/pkg/mastotypes/filter.go +++ /dev/null @@ -1,46 +0,0 @@ -/* - 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 mastotypes - -// 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/pkg/mastotypes/history.go b/pkg/mastotypes/history.go deleted file mode 100644 index 235761378..000000000 --- a/pkg/mastotypes/history.go +++ /dev/null @@ -1,29 +0,0 @@ -/* - 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 mastotypes - -// 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/pkg/mastotypes/identityproof.go b/pkg/mastotypes/identityproof.go deleted file mode 100644 index 7265d46e3..000000000 --- a/pkg/mastotypes/identityproof.go +++ /dev/null @@ -1,33 +0,0 @@ -/* - 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 mastotypes - -// 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/pkg/mastotypes/instance.go b/pkg/mastotypes/instance.go deleted file mode 100644 index 10e626a8e..000000000 --- a/pkg/mastotypes/instance.go +++ /dev/null @@ -1,72 +0,0 @@ -/* - 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 mastotypes - -// 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/pkg/mastotypes/list.go b/pkg/mastotypes/list.go deleted file mode 100644 index 5b704367b..000000000 --- a/pkg/mastotypes/list.go +++ /dev/null @@ -1,31 +0,0 @@ -/* - 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 mastotypes - -// 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/pkg/mastotypes/marker.go b/pkg/mastotypes/marker.go deleted file mode 100644 index 790322313..000000000 --- a/pkg/mastotypes/marker.go +++ /dev/null @@ -1,37 +0,0 @@ -/* - 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 mastotypes - -// 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/pkg/mastotypes/mention.go b/pkg/mastotypes/mention.go deleted file mode 100644 index 81a593d99..000000000 --- a/pkg/mastotypes/mention.go +++ /dev/null @@ -1,31 +0,0 @@ -/* - 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 mastotypes - -// 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/pkg/mastotypes/notification.go b/pkg/mastotypes/notification.go deleted file mode 100644 index 26d361b43..000000000 --- a/pkg/mastotypes/notification.go +++ /dev/null @@ -1,45 +0,0 @@ -/* - 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 mastotypes - -// 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/pkg/mastotypes/oauth.go b/pkg/mastotypes/oauth.go deleted file mode 100644 index d93ea079f..000000000 --- a/pkg/mastotypes/oauth.go +++ /dev/null @@ -1,37 +0,0 @@ -/* - 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 mastotypes - -// 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/pkg/mastotypes/poll.go b/pkg/mastotypes/poll.go deleted file mode 100644 index bedaebec2..000000000 --- a/pkg/mastotypes/poll.go +++ /dev/null @@ -1,64 +0,0 @@ -/* - 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 mastotypes - -// Poll represents the mastodon-api poll type, as described here: https://docs.joinmastodon.org/entities/poll/ -type Poll struct { - // The ID of the poll in the database. - ID string `json:"id"` - // When the poll ends. (ISO 8601 Datetime), or null if the poll does not end - ExpiresAt string `json:"expires_at"` - // Is the poll currently expired? - Expired bool `json:"expired"` - // Does the poll allow multiple-choice answers? - Multiple bool `json:"multiple"` - // How many votes have been received. - VotesCount int `json:"votes_count"` - // How many unique accounts have voted on a multiple-choice poll. Null if multiple is false. - VotersCount int `json:"voters_count,omitempty"` - // When called with a user token, has the authorized user voted? - Voted bool `json:"voted,omitempty"` - // When called with a user token, which options has the authorized user chosen? Contains an array of index values for options. - OwnVotes []int `json:"own_votes,omitempty"` - // Possible answers for the poll. - Options []PollOptions `json:"options"` - // Custom emoji to be used for rendering poll options. - Emojis []Emoji `json:"emojis"` -} - -// PollOptions represents the current vote counts for different poll options -type PollOptions struct { - // The text value of the poll option. String. - Title string `json:"title"` - // The number of received votes for this option. Number, or null if results are not published yet. - VotesCount int `json:"votes_count,omitempty"` -} - -// PollRequest represents a mastodon-api poll attached to a status POST request, as defined here: https://docs.joinmastodon.org/methods/statuses/ -// It should be used at the path https://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/pkg/mastotypes/preferences.go b/pkg/mastotypes/preferences.go deleted file mode 100644 index c28f5d5ab..000000000 --- a/pkg/mastotypes/preferences.go +++ /dev/null @@ -1,40 +0,0 @@ -/* - 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 mastotypes - -// 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/pkg/mastotypes/pushsubscription.go b/pkg/mastotypes/pushsubscription.go deleted file mode 100644 index 4d7535100..000000000 --- a/pkg/mastotypes/pushsubscription.go +++ /dev/null @@ -1,45 +0,0 @@ -/* - 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 mastotypes - -// 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/pkg/mastotypes/relationship.go b/pkg/mastotypes/relationship.go deleted file mode 100644 index 1e0bbab46..000000000 --- a/pkg/mastotypes/relationship.go +++ /dev/null @@ -1,49 +0,0 @@ -/* - 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 mastotypes - -// 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/pkg/mastotypes/results.go b/pkg/mastotypes/results.go deleted file mode 100644 index 3fa7c7abb..000000000 --- a/pkg/mastotypes/results.go +++ /dev/null @@ -1,29 +0,0 @@ -/* - 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 mastotypes - -// 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/pkg/mastotypes/scheduledstatus.go b/pkg/mastotypes/scheduledstatus.go deleted file mode 100644 index ff45eaade..000000000 --- a/pkg/mastotypes/scheduledstatus.go +++ /dev/null @@ -1,39 +0,0 @@ -/* - 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 mastotypes - -// 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/pkg/mastotypes/source.go b/pkg/mastotypes/source.go deleted file mode 100644 index 4142540a7..000000000 --- a/pkg/mastotypes/source.go +++ /dev/null @@ -1,41 +0,0 @@ -/* - 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 mastotypes - -// 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 string `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/pkg/mastotypes/status.go b/pkg/mastotypes/status.go deleted file mode 100644 index e98504e27..000000000 --- a/pkg/mastotypes/status.go +++ /dev/null @@ -1,110 +0,0 @@ -/* - 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 mastotypes - -// StatusRequest 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 StatusRequest 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 string `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"` -} - -// 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"` - // ID of the account being replied to. - InReplyToAccountID string `json:"in_reply_to_account_id"` - // 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"` - // Visibility of this status. - // public = Visible to everyone, shown in public timelines. - // unlisted = Visible to public, but not included in public timelines. - // private = Visible to followers only, and to any mentioned users. - // direct = Visible only to mentioned users. - Visibility string `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"` - // 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"` -} diff --git a/pkg/mastotypes/tag.go b/pkg/mastotypes/tag.go deleted file mode 100644 index 4431ac3e9..000000000 --- a/pkg/mastotypes/tag.go +++ /dev/null @@ -1,23 +0,0 @@ -/* - 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 mastotypes - -// Tag represents a hashtag used within the content of a status. See https://docs.joinmastodon.org/entities/tag/ -type Tag struct { -} diff --git a/pkg/mastotypes/token.go b/pkg/mastotypes/token.go deleted file mode 100644 index c9ac1f177..000000000 --- a/pkg/mastotypes/token.go +++ /dev/null @@ -1,31 +0,0 @@ -/* - 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 mastotypes - -// 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"` -} |