Documentation ¶
Index ¶
Constants ¶
const ( // InstanceInformationPath is for serving instance info requests InstanceInformationPath = "api/v1/instance" // InstancePeersPath is for serving instance peers requests. InstancePeersPath = InstanceInformationPath + "/peers" // PeersFilterKey is used to provide filters to /api/v1/instance/peers PeersFilterKey = "filter" )
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(processor processing.Processor) api.ClientModule
New returns a new instance information module
Types ¶
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
Module implements the ClientModule interface
func (*Module) InstanceInformationGETHandler ¶
InstanceInformationGETHandler swagger:operation GET /api/v1/instance instanceGet
View instance information.
This is mostly provided for Mastodon application compatibility, since many apps that work with Mastodon use `/api/v1/instance` to inform their connection parameters.
However, it can also be used by other instances for gathering instance information and representing instances in some UI or other.
--- tags: - instance
produces: - application/json
responses:
'200': description: "Instance information." schema: "$ref": "#/definitions/instance" '406': description: not acceptable '500': description: internal error
func (*Module) InstancePeersGETHandler ¶ added in v0.3.7
InstancePeersGETHandler swagger:operation GET /api/v1/instance/peers instancePeersGet
--- tags: - instance
produces: - application/json
parameters:
- name: filter type: string description: |- Comma-separated list of filters to apply to results. Recognized values are: 'open' -- include peers that are not suspended or silenced 'suspended' -- include peers that have been suspended. If filter is 'open', only instances that haven't been suspended or silenced will be returned. If filter is 'suspended', only suspended instances will be shown. If filter is 'open,suspended', then all known instances will be returned. If filter is an empty string or not set, then 'open' will be assumed as the default. in: query required: false
responses:
'200': description: |- If no filter parameter is provided, or filter is empty, then a legacy, Mastodon-API compatible response will be returned. This will consist of just a 'flat' array of strings like `["example.com", "example.org"]`. If a filter parameter is provided, then an array of objects with at least a `domain` key set on each object will be returned. Domains that are silenced or suspended will also have a key 'suspended_at' or 'silenced_at' that contains an iso8601 date string. If one of these keys is not present on the domain object, it is open. Suspended instances may in some cases be obfuscated, which means they will have some letters replaced by '*' to make it more difficult for bad actors to target instances with harassment. Whether a flat response or a more detailed response is returned, domains will be sorted alphabetically by hostname. schema: type: array items: "$ref": "#/definitions/domain" '400': description: bad request '401': description: unauthorized '403': description: forbidden '404': description: not found '406': description: not acceptable '500': description: internal server error
func (*Module) InstanceUpdatePATCHHandler ¶
InstanceUpdatePATCHHandler swagger:operation PATCH /api/v1/instance instanceUpdate
Update your instance information and/or upload a new avatar/header for the instance.
This requires admin permissions on the instance.
--- tags: - instance
consumes: - multipart/form-data
produces: - application/json
parameters:
- name: title in: formData description: Title to use for the instance. type: string maximum: 40 allowEmptyValue: true
- name: contact_username in: formData description: |- Username of the contact account. This must be the username of an instance admin. type: string allowEmptyValue: true
- name: contact_email in: formData description: Email address to use as the instance contact. type: string allowEmptyValue: true
- name: short_description in: formData description: Short description of the instance. type: string maximum: 500 allowEmptyValue: true
- name: description in: formData description: Longer description of the instance. type: string maximum: 5000 allowEmptyValue: true
- name: terms in: formData description: Terms and conditions of the instance. type: string maximum: 5000 allowEmptyValue: true
- name: avatar in: formData description: Avatar of the instance. type: file
- name: header in: formData description: Header of the instance. type: file
security: - OAuth2 Bearer:
- admin
responses:
'200': description: "The newly updated instance." schema: "$ref": "#/definitions/instance" '400': description: bad request '401': description: unauthorized '403': description: forbidden '404': description: not found '406': description: not acceptable '500': description: internal server error