instance

package
v0.16.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 16, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InstanceInformationPathV1 = "/v1/instance"
	InstanceInformationPathV2 = "/v2/instance"
	InstancePeersPath         = InstanceInformationPathV1 + "/peers"
	InstanceRulesPath         = InstanceInformationPathV1 + "/rules"
	PeersFilterKey            = "filter" // PeersFilterKey is used to provide filters to /api/v1/instance/peers
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Module

type Module struct {
	// contains filtered or unexported fields
}

func New

func New(processor *processing.Processor) *Module

func (*Module) InstanceInformationGETHandlerV1 added in v0.7.0

func (m *Module) InstanceInformationGETHandlerV1(c *gin.Context)

InstanceInformationV1GETHandlerV1 swagger:operation GET /api/v1/instance instanceGetV1

View instance information.

---
tags:
- instance

produces:
- application/json

responses:
	'200':
		description: "Instance information."
		schema:
			"$ref": "#/definitions/instanceV1"
	'406':
		description: not acceptable
	'500':
		description: internal error

func (*Module) InstanceInformationGETHandlerV2 added in v0.7.0

func (m *Module) InstanceInformationGETHandlerV2(c *gin.Context)

InstanceInformationGETHandlerV2 swagger:operation GET /api/v2/instance instanceGetV2

View instance information.

---
tags:
- instance

produces:
- application/json

responses:
	'200':
		description: "Instance information."
		schema:
			"$ref": "#/definitions/instanceV2"
	'406':
		description: not acceptable
	'500':
		description: internal error

func (*Module) InstancePeersGETHandler added in v0.3.7

func (m *Module) InstancePeersGETHandler(c *gin.Context)

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 filters 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
	default: "open"

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"]`,
			which corresponds to domains this instance peers with.

			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) InstanceRulesGETHandler added in v0.12.0

func (m *Module) InstanceRulesGETHandler(c *gin.Context)

instanceRulesGETHandler swagger:operation GET /api/v1/instance/rules rules

View instance rules (public).

The rules will be returned in order (sorted by Order ascending).

---
tags:
- instance

produces:
- application/json

parameters:

responses:
	'200':
		description: An array with all the rules for the local instance.
		schema:
			type: array
			items:
				"$ref": "#/definitions/instanceRule"
	'400':
		description: bad request
	'404':
		description: not found
	'406':
		description: not acceptable
	'500':
		description: internal server error

func (*Module) InstanceUpdatePATCHHandler

func (m *Module) InstanceUpdatePATCHHandler(c *gin.Context)

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
	maxLength: 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
	maxLength: 500
	allowEmptyValue: true
-
	name: description
	in: formData
	description: Longer description of the instance.
	type: string
	maxLength: 5000
	allowEmptyValue: true
-
	name: terms
	in: formData
	description: Terms and conditions of the instance.
	type: string
	maxLength: 5000
	allowEmptyValue: true
-
	name: thumbnail
	in: formData
	description: Thumbnail image to use for the instance.
	type: file
-
	name: thumbnail_description
	in: formData
	description: Image description of the submitted instance thumbnail.
	type: string
-
	name: header
	in: formData
	description: Header image to use for the instance.
	type: file

security:
- OAuth2 Bearer:
	- admin

responses:
	'200':
		description: "The newly updated instance."
		schema:
			"$ref": "#/definitions/instanceV1"
	'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) Route

func (m *Module) Route(attachHandler func(method string, path string, f ...gin.HandlerFunc) gin.IRoutes)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL