notifications

package
v0.17.2 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// IDKey is for notification UUIDs
	IDKey = "id"
	// BasePath is the base path for serving the notification API, minus the 'api' prefix.
	BasePath = "/v1/notifications"
	// BasePathWithID is just the base path with the ID key in it.
	// Use this anywhere you need to know the ID of the notification being queried.
	BasePathWithID    = BasePath + "/:" + IDKey
	BasePathWithClear = BasePath + "/clear"

	// TypesKey names an array param specifying notification types to include.
	TypesKey = "types[]"
	// ExcludeTypesKey names an array param specifying notification types to exclude.
	ExcludeTypesKey = "exclude_types[]"
	MaxIDKey        = "max_id"
	LimitKey        = "limit"
	SinceIDKey      = "since_id"
	MinIDKey        = "min_id"
)

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) NotificationGETHandler added in v0.9.0

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

NotificationGETHandler swagger:operation GET /api/v1/notification/{id} notification

Get a single notification with the given ID.

---
tags:
- notifications

produces:
- application/json

parameters:
-
	name: id
	type: string
	description: The ID of the notification.
	in: path
	required: true

security:
- OAuth2 Bearer:
	- read:notifications

responses:
	'200':
		name: notifications
		description: Requested notification.
		schema:
			"$ref": "#/definitions/notification"
	'400':
		description: bad request
	'401':
		description: unauthorized
	'404':
		description: not found
	'406':
		description: not acceptable
	'500':
		description: internal server error

func (*Module) NotificationsClearPOSTHandler

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

NotificationsClearPOSTHandler swagger:operation POST /api/v1/notifications/clear clearNotifications

Clear/delete all notifications for currently authorized user.

Will return an empty object `{}` to indicate success.

---
tags:
- notifications

produces:
- application/json

security:
- OAuth2 Bearer:
	- read:notifications

responses:
	'200':
		schema:
			type: object
	'400':
		description: bad request
	'401':
		description: unauthorized
	'404':
		description: not found
	'406':
		description: not acceptable
	'500':
		description: internal server error

func (*Module) NotificationsGETHandler

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

NotificationsGETHandler swagger:operation GET /api/v1/notifications notifications

Get notifications for currently authorized user.

The notifications will be returned in descending chronological order (newest first), with sequential IDs (bigger = newer).

The next and previous queries can be parsed from the returned Link header. Example:

``` <https://example.org/api/v1/notifications?limit=80&max_id=01FC0SKA48HNSVR6YKZCQGS2V8>; rel="next", <https://example.org/api/v1/notifications?limit=80&since_id=01FC0SKW5JK2Q4EVAV2B462YY0>; rel="prev" ````

---
tags:
- notifications

produces:
- application/json

parameters:
-
	name: max_id
	type: string
	description: >-
		Return only notifications *OLDER* than the given max notification ID.
		The notification with the specified ID will not be included in the response.
	in: query
	required: false
-
	name: since_id
	type: string
	description: >-
		Return only notifications *newer* than the given since notification ID.
		The notification with the specified ID will not be included in the response.
	in: query
-
	name: min_id
	type: string
	description: >-
		Return only notifications *immediately newer* than the given since notification ID.
		The notification with the specified ID will not be included in the response.
	in: query
	required: false
-
	name: limit
	type: integer
	description: Number of notifications to return.
	default: 20
	in: query
	required: false
-
	name: types[]
	type: array
	items:
		type: string
		enum:
			- follow
			- follow_request
			- mention
			- reblog
			- favourite
			- poll
			- status
			- admin.sign_up
	description: Types of notifications to include. If not provided, all notification types will be included.
	in: query
	required: false
-
	name: exclude_types[]
	type: array
	items:
		type: string
		enum:
			- follow
			- follow_request
			- mention
			- reblog
			- favourite
			- poll
			- status
			- admin.sign_up
	description: Types of notifications to exclude.
	in: query
	required: false

security:
- OAuth2 Bearer:
	- read:notifications

responses:
	'200':
		headers:
			Link:
				type: string
				description: Links to the next and previous queries.
		name: notifications
		description: Array of notifications.
		schema:
			type: array
			items:
				"$ref": "#/definitions/notification"
	'400':
		description: bad request
	'401':
		description: unauthorized
	'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