gtsocial-umbx

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

well-known.go (3720B)


      1 // GoToSocial
      2 // Copyright (C) GoToSocial Authors admin@gotosocial.org
      3 // SPDX-License-Identifier: AGPL-3.0-or-later
      4 //
      5 // This program is free software: you can redistribute it and/or modify
      6 // it under the terms of the GNU Affero General Public License as published by
      7 // the Free Software Foundation, either version 3 of the License, or
      8 // (at your option) any later version.
      9 //
     10 // This program is distributed in the hope that it will be useful,
     11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
     12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     13 // GNU Affero General Public License for more details.
     14 //
     15 // You should have received a copy of the GNU Affero General Public License
     16 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
     17 
     18 package model
     19 
     20 import "encoding/xml"
     21 
     22 // WellKnownResponse represents the response to either a webfinger request for an 'acct' resource, or a request to nodeinfo.
     23 // For example, it would be returned from https://example.org/.well-known/webfinger?resource=acct:some_username@example.org
     24 //
     25 // See https://webfinger.net/
     26 //
     27 // swagger:model wellKnownResponse
     28 type WellKnownResponse struct {
     29 	Subject string   `json:"subject,omitempty"`
     30 	Aliases []string `json:"aliases,omitempty"`
     31 	Links   []Link   `json:"links,omitempty"`
     32 }
     33 
     34 // Link represents one 'link' in a slice of links returned from a lookup request.
     35 //
     36 // See https://webfinger.net/ and https://www.rfc-editor.org/rfc/rfc6415.html#section-3.1
     37 type Link struct {
     38 	Rel      string `json:"rel" xml:"rel,attr"`
     39 	Type     string `json:"type,omitempty" xml:"type,attr,omitempty"`
     40 	Href     string `json:"href,omitempty" xml:"href,attr,omitempty"`
     41 	Template string `json:"template,omitempty" xml:"template,attr,omitempty"`
     42 }
     43 
     44 // Nodeinfo represents a version 2.1 or version 2.0 nodeinfo schema.
     45 // See: https://nodeinfo.diaspora.software/schema.html
     46 //
     47 // swagger:model nodeinfo
     48 type Nodeinfo struct {
     49 	// The schema version
     50 	// example: 2.0
     51 	Version string `json:"version"`
     52 	// Metadata about server software in use.
     53 	Software NodeInfoSoftware `json:"software"`
     54 	// The protocols supported on this server.
     55 	Protocols []string `json:"protocols"`
     56 	// The third party sites this server can connect to via their application API.
     57 	Services NodeInfoServices `json:"services"`
     58 	// Whether this server allows open self-registration.
     59 	// example: false
     60 	OpenRegistrations bool `json:"openRegistrations"`
     61 	// Usage statistics for this server.
     62 	Usage NodeInfoUsage `json:"usage"`
     63 	// Free form key value pairs for software specific values. Clients should not rely on any specific key present.
     64 	Metadata map[string]interface{} `json:"metadata"`
     65 }
     66 
     67 // NodeInfoSoftware represents the name and version number of the software of this node.
     68 type NodeInfoSoftware struct {
     69 	// example: gotosocial
     70 	Name string `json:"name"`
     71 	// example: 0.1.2 1234567
     72 	Version string `json:"version"`
     73 }
     74 
     75 // NodeInfoServices represents inbound and outbound services that this node offers connections to.
     76 type NodeInfoServices struct {
     77 	Inbound  []string `json:"inbound"`
     78 	Outbound []string `json:"outbound"`
     79 }
     80 
     81 // NodeInfoUsage represents usage information about this server, such as number of users.
     82 type NodeInfoUsage struct {
     83 	Users      NodeInfoUsers `json:"users"`
     84 	LocalPosts int           `json:"localPosts"`
     85 }
     86 
     87 // NodeInfoUsers represents aggregate information about the users on the server.
     88 type NodeInfoUsers struct {
     89 	Total int `json:"total"`
     90 }
     91 
     92 // HostMeta represents a hostmeta document.
     93 // See: https://www.rfc-editor.org/rfc/rfc6415.html#section-3
     94 //
     95 // swagger:model hostmeta
     96 type HostMeta struct {
     97 	XMLName xml.Name `xml:"XRD"`
     98 	XMLNS   string   `xml:"xmlns,attr"`
     99 	Link    []Link   `xml:"Link"`
    100 }