more mastotypes

This commit is contained in:
tsmethurst 2021-03-12 17:15:24 +01:00
parent 90d59d5e09
commit bc7302afa1
5 changed files with 185 additions and 1 deletions

View file

@ -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
// 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"`
}

View file

@ -0,0 +1,81 @@
/*
GoToSocial
Copyright (C) 2021 GoToSocial Authors admin@gotosocial.org
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package 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"`
}

View file

@ -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
// 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"`
}

View file

@ -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
// 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"`
}

View file

@ -20,5 +20,7 @@
// 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 {
URL string `json:"url"`
Title string `json:"title"`
Description string `json:"description"`
}