Add Accept header negotiation to relevant API endpoints (#337)

* start centralizing negotiation logic for API

* swagger document nodeinfo endpoint

* go fmt

* document negotiate function

* use content negotiation

* tidy up negotiation logic

* negotiate content throughout client api

* swagger

* remove attachment on Content

* add accept header to test requests
This commit is contained in:
tobi
2021-12-11 17:50:00 +01:00
committed by GitHub
parent 0884f89431
commit e2daf0f012
78 changed files with 752 additions and 72 deletions

View File

@@ -22,6 +22,8 @@ package model
// For example, it would be returned from https://example.org/.well-known/webfinger?resource=acct:some_username@example.org
//
// See https://webfinger.net/
//
// swagger:model wellKnownResponse
type WellKnownResponse struct {
Subject string `json:"subject,omitempty"`
Aliases []string `json:"aliases,omitempty"`
@@ -40,8 +42,11 @@ type Link struct {
// Nodeinfo represents a version 2.1 or version 2.0 nodeinfo schema.
// See: https://nodeinfo.diaspora.software/schema.html
//
// swagger:model nodeinfo
type Nodeinfo struct {
// The schema version
// example: 2.0
Version string `json:"version"`
// Metadata about server software in use.
Software NodeInfoSoftware `json:"software"`
@@ -50,6 +55,7 @@ type Nodeinfo struct {
// The third party sites this server can connect to via their application API.
Services NodeInfoServices `json:"services"`
// Whether this server allows open self-registration.
// example: false
OpenRegistrations bool `json:"openRegistrations"`
// Usage statistics for this server.
Usage NodeInfoUsage `json:"usage"`
@@ -59,7 +65,9 @@ type Nodeinfo struct {
// NodeInfoSoftware represents the name and version number of the software of this node.
type NodeInfoSoftware struct {
Name string `json:"name"`
// example: gotosocial
Name string `json:"name"`
// example: 0.1.2 1234567
Version string `json:"version"`
}