From 1165d247a11ec9b4931357e91efbb6fc55e69bb1 Mon Sep 17 00:00:00 2001 From: tsmethurst Date: Sat, 13 Mar 2021 17:07:05 +0100 Subject: [PATCH] more mastotypes --- pkg/mastotypes/model/announcementreaction.go | 8 +-- pkg/mastotypes/model/context.go | 27 ++++++++ pkg/mastotypes/model/conversation.go | 36 ++++++++++ pkg/mastotypes/model/error.go | 32 +++++++++ pkg/mastotypes/model/featuredtag.go | 33 +++++++++ pkg/mastotypes/model/field.go | 2 +- pkg/mastotypes/model/filter.go | 46 +++++++++++++ pkg/mastotypes/model/history.go | 29 ++++++++ pkg/mastotypes/model/identityproof.go | 33 +++++++++ pkg/mastotypes/model/instance.go | 72 ++++++++++++++++++++ pkg/mastotypes/model/list.go | 31 +++++++++ pkg/mastotypes/model/marker.go | 37 ++++++++++ pkg/mastotypes/model/notification.go | 45 ++++++++++++ pkg/mastotypes/model/poll.go | 30 ++++---- pkg/mastotypes/model/preferences.go | 40 +++++++++++ pkg/mastotypes/model/pushsubscription.go | 45 ++++++++++++ pkg/mastotypes/model/relationship.go | 49 +++++++++++++ pkg/mastotypes/model/results.go | 29 ++++++++ 18 files changed, 604 insertions(+), 20 deletions(-) create mode 100644 pkg/mastotypes/model/context.go create mode 100644 pkg/mastotypes/model/conversation.go create mode 100644 pkg/mastotypes/model/error.go create mode 100644 pkg/mastotypes/model/featuredtag.go create mode 100644 pkg/mastotypes/model/filter.go create mode 100644 pkg/mastotypes/model/history.go create mode 100644 pkg/mastotypes/model/identityproof.go create mode 100644 pkg/mastotypes/model/instance.go create mode 100644 pkg/mastotypes/model/list.go create mode 100644 pkg/mastotypes/model/marker.go create mode 100644 pkg/mastotypes/model/notification.go create mode 100644 pkg/mastotypes/model/preferences.go create mode 100644 pkg/mastotypes/model/pushsubscription.go create mode 100644 pkg/mastotypes/model/relationship.go create mode 100644 pkg/mastotypes/model/results.go diff --git a/pkg/mastotypes/model/announcementreaction.go b/pkg/mastotypes/model/announcementreaction.go index 81d04bcae..444c57e2c 100644 --- a/pkg/mastotypes/model/announcementreaction.go +++ b/pkg/mastotypes/model/announcementreaction.go @@ -21,13 +21,13 @@ 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"` + Name string `json:"name"` // The total number of users who have added this reaction. - Count int `json:"count"` + Count int `json:"count"` // Whether the authorized user has added this reaction to the announcement. - Me bool `json:"me"` + Me bool `json:"me"` // A link to the custom emoji. - URL string `json:"url,omitempty"` + 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/model/context.go b/pkg/mastotypes/model/context.go new file mode 100644 index 000000000..397522dc7 --- /dev/null +++ b/pkg/mastotypes/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 . +*/ + +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/model/conversation.go b/pkg/mastotypes/model/conversation.go new file mode 100644 index 000000000..ed95c124c --- /dev/null +++ b/pkg/mastotypes/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 . +*/ + +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/model/error.go b/pkg/mastotypes/model/error.go new file mode 100644 index 000000000..394085724 --- /dev/null +++ b/pkg/mastotypes/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 . +*/ + +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/model/featuredtag.go b/pkg/mastotypes/model/featuredtag.go new file mode 100644 index 000000000..0e0bbe802 --- /dev/null +++ b/pkg/mastotypes/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 . +*/ + +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/model/field.go b/pkg/mastotypes/model/field.go index 0de91cd47..dbfe08c54 100644 --- a/pkg/mastotypes/model/field.go +++ b/pkg/mastotypes/model/field.go @@ -31,4 +31,4 @@ type Field struct { // Timestamp of when the server verified a URL value for a rel="me” link. String (ISO 8601 Datetime) if value is a verified URL VerifiedAt string `json:"verified_at,omitempty"` -} \ No newline at end of file +} diff --git a/pkg/mastotypes/model/filter.go b/pkg/mastotypes/model/filter.go new file mode 100644 index 000000000..86d9795a3 --- /dev/null +++ b/pkg/mastotypes/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 . +*/ + +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/model/history.go b/pkg/mastotypes/model/history.go new file mode 100644 index 000000000..235761378 --- /dev/null +++ b/pkg/mastotypes/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 . +*/ + +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/model/identityproof.go b/pkg/mastotypes/model/identityproof.go new file mode 100644 index 000000000..7265d46e3 --- /dev/null +++ b/pkg/mastotypes/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 . +*/ + +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/model/instance.go b/pkg/mastotypes/model/instance.go new file mode 100644 index 000000000..10e626a8e --- /dev/null +++ b/pkg/mastotypes/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 . +*/ + +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/model/list.go b/pkg/mastotypes/model/list.go new file mode 100644 index 000000000..5b704367b --- /dev/null +++ b/pkg/mastotypes/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 . +*/ + +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/model/marker.go b/pkg/mastotypes/model/marker.go new file mode 100644 index 000000000..790322313 --- /dev/null +++ b/pkg/mastotypes/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 . +*/ + +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/model/notification.go b/pkg/mastotypes/model/notification.go new file mode 100644 index 000000000..26d361b43 --- /dev/null +++ b/pkg/mastotypes/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 . +*/ + +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/model/poll.go b/pkg/mastotypes/model/poll.go index eab069970..bedaebec2 100644 --- a/pkg/mastotypes/model/poll.go +++ b/pkg/mastotypes/model/poll.go @@ -29,25 +29,25 @@ type Poll struct { // 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"` + 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"` + // 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/ diff --git a/pkg/mastotypes/model/preferences.go b/pkg/mastotypes/model/preferences.go new file mode 100644 index 000000000..c28f5d5ab --- /dev/null +++ b/pkg/mastotypes/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 . +*/ + +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/model/pushsubscription.go b/pkg/mastotypes/model/pushsubscription.go new file mode 100644 index 000000000..4d7535100 --- /dev/null +++ b/pkg/mastotypes/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 . +*/ + +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/model/relationship.go b/pkg/mastotypes/model/relationship.go new file mode 100644 index 000000000..1e0bbab46 --- /dev/null +++ b/pkg/mastotypes/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 . +*/ + +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/model/results.go b/pkg/mastotypes/model/results.go new file mode 100644 index 000000000..3fa7c7abb --- /dev/null +++ b/pkg/mastotypes/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 . +*/ + +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"` +}