commit 1165d247a11ec9b4931357e91efbb6fc55e69bb1 parent bc7302afa10c81bbc6d04b3c91991a01c67b06df Author: tsmethurst <tobi.smethurst@klarrio.com> Date: Sat, 13 Mar 2021 17:07:05 +0100 more mastotypes Diffstat:
M | pkg/mastotypes/model/announcementreaction.go | | | 8 | ++++---- |
A | pkg/mastotypes/model/context.go | | | 27 | +++++++++++++++++++++++++++ |
A | pkg/mastotypes/model/conversation.go | | | 36 | ++++++++++++++++++++++++++++++++++++ |
A | pkg/mastotypes/model/error.go | | | 32 | ++++++++++++++++++++++++++++++++ |
A | pkg/mastotypes/model/featuredtag.go | | | 33 | +++++++++++++++++++++++++++++++++ |
M | pkg/mastotypes/model/field.go | | | 3 | +-- |
A | pkg/mastotypes/model/filter.go | | | 46 | ++++++++++++++++++++++++++++++++++++++++++++++ |
A | pkg/mastotypes/model/history.go | | | 29 | +++++++++++++++++++++++++++++ |
A | pkg/mastotypes/model/identityproof.go | | | 33 | +++++++++++++++++++++++++++++++++ |
A | pkg/mastotypes/model/instance.go | | | 72 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | pkg/mastotypes/model/list.go | | | 31 | +++++++++++++++++++++++++++++++ |
A | pkg/mastotypes/model/marker.go | | | 37 | +++++++++++++++++++++++++++++++++++++ |
A | pkg/mastotypes/model/notification.go | | | 45 | +++++++++++++++++++++++++++++++++++++++++++++ |
M | pkg/mastotypes/model/poll.go | | | 30 | +++++++++++++++--------------- |
A | pkg/mastotypes/model/preferences.go | | | 40 | ++++++++++++++++++++++++++++++++++++++++ |
A | pkg/mastotypes/model/pushsubscription.go | | | 45 | +++++++++++++++++++++++++++++++++++++++++++++ |
A | pkg/mastotypes/model/relationship.go | | | 49 | +++++++++++++++++++++++++++++++++++++++++++++++++ |
A | pkg/mastotypes/model/results.go | | | 29 | +++++++++++++++++++++++++++++ |
18 files changed, 604 insertions(+), 21 deletions(-)
diff --git 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 @@ -0,0 +1,27 @@ +/* + GoToSocial + Copyright (C) 2021 GoToSocial Authors admin@gotosocial.org + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +package 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 @@ -0,0 +1,36 @@ +/* + GoToSocial + Copyright (C) 2021 GoToSocial Authors admin@gotosocial.org + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +package 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 @@ -0,0 +1,32 @@ +/* + GoToSocial + Copyright (C) 2021 GoToSocial Authors admin@gotosocial.org + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +package 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 @@ -0,0 +1,33 @@ +/* + GoToSocial + Copyright (C) 2021 GoToSocial Authors admin@gotosocial.org + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +package 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 @@ -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 @@ -0,0 +1,46 @@ +/* + GoToSocial + Copyright (C) 2021 GoToSocial Authors admin@gotosocial.org + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +package 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 @@ -0,0 +1,29 @@ +/* + GoToSocial + Copyright (C) 2021 GoToSocial Authors admin@gotosocial.org + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +package 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 @@ -0,0 +1,33 @@ +/* + GoToSocial + Copyright (C) 2021 GoToSocial Authors admin@gotosocial.org + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +package 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 @@ -0,0 +1,72 @@ +/* + GoToSocial + Copyright (C) 2021 GoToSocial Authors admin@gotosocial.org + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +package 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 @@ -0,0 +1,31 @@ +/* + GoToSocial + Copyright (C) 2021 GoToSocial Authors admin@gotosocial.org + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +package 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 @@ -0,0 +1,37 @@ +/* + GoToSocial + Copyright (C) 2021 GoToSocial Authors admin@gotosocial.org + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +package 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 @@ -0,0 +1,45 @@ +/* + GoToSocial + Copyright (C) 2021 GoToSocial Authors admin@gotosocial.org + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +package 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 @@ -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 @@ -0,0 +1,40 @@ +/* + GoToSocial + Copyright (C) 2021 GoToSocial Authors admin@gotosocial.org + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +package 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 @@ -0,0 +1,45 @@ +/* + GoToSocial + Copyright (C) 2021 GoToSocial Authors admin@gotosocial.org + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +package 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 @@ -0,0 +1,49 @@ +/* + GoToSocial + Copyright (C) 2021 GoToSocial Authors admin@gotosocial.org + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +package 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 @@ -0,0 +1,29 @@ +/* + GoToSocial + Copyright (C) 2021 GoToSocial Authors admin@gotosocial.org + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +package 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"` +}