mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[feature] Implement /api/v2/instance
endpoint (#1409)
* interim: start adding /api/v2/instance * finish up
This commit is contained in:
@@ -20,93 +20,41 @@ package model
|
||||
|
||||
import "mime/multipart"
|
||||
|
||||
// Instance models information about this or another instance.
|
||||
// InstanceSettingsUpdateRequest models an instance update request.
|
||||
//
|
||||
// swagger:model instance
|
||||
type Instance struct {
|
||||
// The URI of the instance.
|
||||
// example: https://gts.example.org
|
||||
URI string `json:"uri,omitempty"`
|
||||
// The domain of accounts on this instance.
|
||||
// This will not necessarily be the same as
|
||||
// simply the Host part of the URI.
|
||||
// example: example.org
|
||||
AccountDomain string `json:"account_domain,omitempty"`
|
||||
// The title of the instance.
|
||||
// example: GoToSocial Example Instance
|
||||
Title string `json:"title,omitempty"`
|
||||
// Description of the instance.
|
||||
//
|
||||
// Should be HTML formatted, but might be plaintext.
|
||||
//
|
||||
// This should be displayed on the 'about' page for an instance.
|
||||
Description string `json:"description"`
|
||||
// A shorter description of the instance.
|
||||
//
|
||||
// Should be HTML formatted, but might be plaintext.
|
||||
//
|
||||
// This should be displayed on the instance splash/landing page.
|
||||
ShortDescription string `json:"short_description"`
|
||||
// An email address that may be used for inquiries.
|
||||
// example: admin@example.org
|
||||
Email string `json:"email"`
|
||||
// The version of GoToSocial installed on the instance.
|
||||
//
|
||||
// This will contain at least a semantic version number.
|
||||
//
|
||||
// It may also contain, after a space, the short git commit ID of the running software.
|
||||
//
|
||||
// example: 0.1.1 cb85f65
|
||||
Version string `json:"version"`
|
||||
// Primary language of the instance.
|
||||
// example: en
|
||||
Languages []string `json:"languages,omitempty"`
|
||||
// New account registrations are enabled on this instance.
|
||||
Registrations bool `json:"registrations"`
|
||||
// New account registrations require admin approval.
|
||||
ApprovalRequired bool `json:"approval_required"`
|
||||
// Invites are enabled on this instance.
|
||||
InvitesEnabled bool `json:"invites_enabled"`
|
||||
// Configuration object containing values about status limits etc.
|
||||
// This key/value will be omitted for remote instances.
|
||||
Configuration *InstanceConfiguration `json:"configuration,omitempty"`
|
||||
// URLs of interest for client applications.
|
||||
URLS *InstanceURLs `json:"urls,omitempty"`
|
||||
// Statistics about the instance: number of posts, accounts, etc.
|
||||
Stats map[string]int `json:"stats,omitempty"`
|
||||
// URL of the instance avatar/banner image.
|
||||
// example: https://example.org/files/instance/thumbnail.jpeg
|
||||
Thumbnail string `json:"thumbnail"`
|
||||
// MIME type of the instance thumbnail.
|
||||
// example: image/png
|
||||
ThumbnailType string `json:"thumbnail_type,omitempty"`
|
||||
// Description of the instance thumbnail.
|
||||
// example: picture of a cute lil' friendly sloth
|
||||
ThumbnailDescription string `json:"thumbnail_description,omitempty"`
|
||||
// Contact account for the instance.
|
||||
ContactAccount *Account `json:"contact_account,omitempty"`
|
||||
// Maximum allowed length of a post on this instance, in characters.
|
||||
//
|
||||
// This is provided for compatibility with Tusky and other apps.
|
||||
//
|
||||
// example: 5000
|
||||
MaxTootChars uint `json:"max_toot_chars"`
|
||||
// swagger:ignore
|
||||
type InstanceSettingsUpdateRequest struct {
|
||||
// Title to use for the instance. Max 40 characters.
|
||||
Title *string `form:"title" json:"title" xml:"title"`
|
||||
// Username for the instance contact account. Must be the username of an existing admin.
|
||||
ContactUsername *string `form:"contact_username" json:"contact_username" xml:"contact_username"`
|
||||
// Email for reaching the instance administrator(s).
|
||||
ContactEmail *string `form:"contact_email" json:"contact_email" xml:"contact_email"`
|
||||
// Short description of the instance, max 500 chars. HTML formatting accepted.
|
||||
ShortDescription *string `form:"short_description" json:"short_description" xml:"short_description"`
|
||||
// Longer description of the instance, max 5,000 chars. HTML formatting accepted.
|
||||
Description *string `form:"description" json:"description" xml:"description"`
|
||||
// Terms and conditions of the instance, max 5,000 chars. HTML formatting accepted.
|
||||
Terms *string `form:"terms" json:"terms" xml:"terms"`
|
||||
// Image to use as the instance thumbnail.
|
||||
Avatar *multipart.FileHeader `form:"thumbnail" json:"thumbnail" xml:"thumbnail"`
|
||||
// Image description for the instance avatar.
|
||||
AvatarDescription *string `form:"thumbnail_description" json:"thumbnail_description" xml:"thumbnail_description"`
|
||||
// Image to use as the instance header.
|
||||
Header *multipart.FileHeader `form:"header" json:"header" xml:"header"`
|
||||
}
|
||||
|
||||
// InstanceConfiguration models instance configuration parameters.
|
||||
// InstanceConfigurationAccounts models instance account config parameters.
|
||||
//
|
||||
// swagger:model instanceConfiguration
|
||||
type InstanceConfiguration struct {
|
||||
// Instance configuration pertaining to status limits.
|
||||
Statuses *InstanceConfigurationStatuses `json:"statuses"`
|
||||
// Instance configuration pertaining to media attachment types + size limits.
|
||||
MediaAttachments *InstanceConfigurationMediaAttachments `json:"media_attachments"`
|
||||
// Instance configuration pertaining to poll limits.
|
||||
Polls *InstanceConfigurationPolls `json:"polls"`
|
||||
// Instance configuration pertaining to accounts.
|
||||
Accounts *InstanceConfigurationAccounts `json:"accounts"`
|
||||
// Instance configuration pertaining to emojis.
|
||||
Emojis *InstanceConfigurationEmojis `json:"emojis"`
|
||||
// swagger:model instanceConfigurationAccounts
|
||||
type InstanceConfigurationAccounts struct {
|
||||
// Whether or not accounts on this instance are allowed to upload custom CSS for profiles and statuses.
|
||||
//
|
||||
// example: false
|
||||
AllowCustomCSS bool `json:"allow_custom_css"`
|
||||
// The maximum number of featured tags allowed for each account.
|
||||
// Currently not implemented, so this is hardcoded to 10.
|
||||
MaxFeaturedTags int `json:"max_featured_tags"`
|
||||
}
|
||||
|
||||
// InstanceConfigurationStatuses models instance status config parameters.
|
||||
@@ -185,14 +133,6 @@ type InstanceConfigurationPolls struct {
|
||||
MaxExpiration int `json:"max_expiration"`
|
||||
}
|
||||
|
||||
// InstanceConfigurationAccounts models instance account config parameters.
|
||||
type InstanceConfigurationAccounts struct {
|
||||
// Whether or not accounts on this instance are allowed to upload custom CSS for profiles and statuses.
|
||||
//
|
||||
// example: false
|
||||
AllowCustomCSS bool `json:"allow_custom_css"`
|
||||
}
|
||||
|
||||
// InstanceConfigurationEmojis models instance emoji config parameters.
|
||||
type InstanceConfigurationEmojis struct {
|
||||
// Max allowed emoji image size in bytes.
|
||||
@@ -200,36 +140,3 @@ type InstanceConfigurationEmojis struct {
|
||||
// example: 51200
|
||||
EmojiSizeLimit int `json:"emoji_size_limit"`
|
||||
}
|
||||
|
||||
// InstanceURLs models instance-relevant URLs for client application consumption.
|
||||
//
|
||||
// swagger:model instanceURLs
|
||||
type InstanceURLs struct {
|
||||
// Websockets address for status and notification streaming.
|
||||
// example: wss://example.org
|
||||
StreamingAPI string `json:"streaming_api"`
|
||||
}
|
||||
|
||||
// InstanceSettingsUpdateRequest models an instance update request.
|
||||
//
|
||||
// swagger:ignore
|
||||
type InstanceSettingsUpdateRequest struct {
|
||||
// Title to use for the instance. Max 40 characters.
|
||||
Title *string `form:"title" json:"title" xml:"title"`
|
||||
// Username for the instance contact account. Must be the username of an existing admin.
|
||||
ContactUsername *string `form:"contact_username" json:"contact_username" xml:"contact_username"`
|
||||
// Email for reaching the instance administrator(s).
|
||||
ContactEmail *string `form:"contact_email" json:"contact_email" xml:"contact_email"`
|
||||
// Short description of the instance, max 500 chars. HTML formatting accepted.
|
||||
ShortDescription *string `form:"short_description" json:"short_description" xml:"short_description"`
|
||||
// Longer description of the instance, max 5,000 chars. HTML formatting accepted.
|
||||
Description *string `form:"description" json:"description" xml:"description"`
|
||||
// Terms and conditions of the instance, max 5,000 chars. HTML formatting accepted.
|
||||
Terms *string `form:"terms" json:"terms" xml:"terms"`
|
||||
// Image to use as the instance thumbnail.
|
||||
Avatar *multipart.FileHeader `form:"thumbnail" json:"thumbnail" xml:"thumbnail"`
|
||||
// Image description for the instance avatar.
|
||||
AvatarDescription *string `form:"thumbnail_description" json:"thumbnail_description" xml:"thumbnail_description"`
|
||||
// Image to use as the instance header.
|
||||
Header *multipart.FileHeader `form:"header" json:"header" xml:"header"`
|
||||
}
|
||||
|
Reference in New Issue
Block a user