model

package
v2.2.4 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2023 License: CC-BY-4.0, MIT Imports: 1 Imported by: 12

Documentation

Index

Constants

View Source
const (
	// StatusGreen everything is alright.
	StatusGreen = "green"
	// StatusOrange some things are alright.
	StatusOrange = "orange"
	// StatusRed nothing is alright.
	StatusRed = "red"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Application

type Application struct {
	// The application id.
	//
	// read only: true
	// required: true
	// example: 5
	ID uint `gorm:"primary_key;unique_index;AUTO_INCREMENT" json:"id"`
	// The application token. Can be used as `appToken`. See Authentication.
	//
	// read only: true
	// required: true
	// example: AWH0wZ5r0Mbac.r
	Token  string `gorm:"type:varchar(180);unique_index" json:"token"`
	UserID uint   `gorm:"index" json:"-"`
	// The application name. This is how the application should be displayed to the user.
	//
	// required: true
	// example: Backup Server
	Name string `gorm:"type:text" form:"name" query:"name" json:"name" binding:"required"`
	// The description of the application.
	//
	// required: true
	// example: Backup server for the interwebs
	Description string `gorm:"type:text" form:"description" query:"description" json:"description"`
	// Whether the application is an internal application. Internal applications should not be deleted.
	//
	// read only: true
	// required: true
	// example: false
	Internal bool `form:"internal" query:"internal" json:"internal"`
	// The image of the application.
	//
	// read only: true
	// required: true
	// example: image/image.jpeg
	Image    string            `gorm:"type:text" json:"image"`
	Messages []MessageExternal `json:"-"`
}

Application Model

The Application holds information about an app which can send notifications.

swagger:model Application

type Client

type Client struct {
	// The client id.
	//
	// read only: true
	// required: true
	// example: 5
	ID uint `gorm:"primary_key;unique_index;AUTO_INCREMENT" json:"id"`
	// The client token. Can be used as `clientToken`. See Authentication.
	//
	// read only: true
	// required: true
	// example: CWH0wZ5r0Mbac.r
	Token  string `gorm:"type:varchar(180);unique_index" json:"token"`
	UserID uint   `gorm:"index" json:"-"`
	// The client name. This is how the client should be displayed to the user.
	//
	// required: true
	// example: Android Phone
	Name string `gorm:"type:text" form:"name" query:"name" json:"name" binding:"required"`
}

Client Model

The Client holds information about a device which can receive notifications (and other stuff).

swagger:model Client

type CreateUserExternal added in v2.1.6

type CreateUserExternal struct {
	// The user name. For login.
	//
	// required: true
	// example: unicorn
	Name string `binding:"required" json:"name" query:"name" form:"name"`
	// If the user is an administrator.
	//
	// required: true
	// example: true
	Admin bool `json:"admin" form:"admin" query:"admin"`
	// The user password. For login.
	//
	// required: true
	// example: nrocinu
	Pass string `json:"pass,omitempty" form:"pass" query:"pass" binding:"required"`
}

CreateUserExternal Model

Used for user creation.

swagger:model CreateUserExternal

type Error

type Error struct {
	// The general error message
	//
	// required: true
	// example: Unauthorized
	Error string `json:"error"`
	// The http error code.
	//
	// required: true
	// example: 401
	ErrorCode int `json:"errorCode"`
	// The http error code.
	//
	// required: true
	// example: you need to provide a valid access token or user credentials to access this api
	ErrorDescription string `json:"errorDescription"`
}

Error Model

The Error contains error relevant information.

swagger:model Error

type Health

type Health struct {
	// The health of the overall application.
	//
	// required: true
	// example: green
	Health string `json:"health"`
	// The health of the database connection.
	//
	// required: true
	// example: green
	Database string `json:"database"`
}

Health Model

Health represents how healthy the application is.

swagger:model Health

type Message

type Message struct {
	ID            uint `gorm:"AUTO_INCREMENT;primary_key;index"`
	ApplicationID uint
	Message       string `gorm:"type:text"`
	Title         string `gorm:"type:text"`
	Priority      int
	Extras        []byte
	Date          time.Time
}

Message holds information about a message.

type MessageExternal

type MessageExternal struct {
	// The message id.
	//
	// read only: true
	// required: true
	// example: 25
	ID uint `json:"id"`
	// The application id that send this message.
	//
	// read only: true
	// required: true
	// example: 5
	ApplicationID uint `json:"appid"`
	// The message. Markdown (excluding html) is allowed.
	//
	// required: true
	// example: **Backup** was successfully finished.
	Message string `form:"message" query:"message" json:"message" binding:"required"`
	// The title of the message.
	//
	// example: Backup
	Title string `form:"title" query:"title" json:"title"`
	// The priority of the message.
	//
	// example: 2
	Priority int `form:"priority" query:"priority" json:"priority"`
	// The extra data sent along the message.
	//
	// The extra fields are stored in a key-value scheme. Only accepted in CreateMessage requests with application/json content-type.
	//
	// The keys should be in the following format: <top-namespace>::[<sub-namespace>::]<action>
	//
	// These namespaces are reserved and might be used in the official clients: gotify android ios web server client. Do not use them for other purposes.
	//
	// example: {"home::appliances::thermostat::change_temperature":{"temperature":23},"home::appliances::lighting::on":{"brightness":15}}
	Extras map[string]interface{} `form:"-" query:"-" json:"extras,omitempty"`
	// The date the message was created.
	//
	// read only: true
	// required: true
	// example: 2018-02-27T19:36:10.5045044+01:00
	Date time.Time `json:"date"`
}

MessageExternal Model

The MessageExternal holds information about a message which was sent by an Application.

swagger:model Message

type PagedMessages

type PagedMessages struct {
	// The paging of the messages.
	//
	// read only: true
	// required: true
	Paging Paging `json:"paging"`
	// The messages.
	//
	// read only: true
	// required: true
	Messages []*MessageExternal `json:"messages"`
}

PagedMessages Model

Wrapper for the paging and the messages

swagger:model PagedMessages

type Paging

type Paging struct {
	// The request url for the next page. Empty/Null when no next page is available.
	//
	// read only: true
	// required: false
	// example: http://example.com/message?limit=50&since=123456
	Next string `json:"next,omitempty"`
	// The amount of messages that got returned in the current request.
	//
	// read only: true
	// required: true
	// example: 5
	Size int `json:"size"`
	// The ID of the last message returned in the current request. Use this as alternative to the next link.
	//
	// read only: true
	// required: true
	// example: 5
	// min: 0
	Since uint `json:"since"`
	// The limit of the messages for the current request.
	//
	// read only: true
	// required: true
	// min: 1
	// max: 200
	// example: 123
	Limit int `json:"limit"`
}

Paging Model

The Paging holds information about the limit and making requests to the next page.

swagger:model Paging

type PluginConf

type PluginConf struct {
	ID            uint `gorm:"primary_key;AUTO_INCREMENT;index"`
	UserID        uint
	ModulePath    string `gorm:"type:text"`
	Token         string `gorm:"type:varchar(180);unique_index"`
	ApplicationID uint
	Enabled       bool
	Config        []byte
	Storage       []byte
}

PluginConf holds information about the plugin.

type PluginConfExternal

type PluginConfExternal struct {
	// The plugin id.
	//
	// read only: true
	// required: true
	// example: 25
	ID uint `json:"id"`
	// The plugin name.
	//
	// read only: true
	// required: true
	// example: RSS poller
	Name string `json:"name"`
	// The user name. For login.
	//
	// required: true
	// example: P1234
	Token string `binding:"required" json:"token" query:"token" form:"token"`
	// The module path of the plugin.
	//
	// example: github.com/gotify/server/plugin/example/echo
	// read only: true
	// required: true
	ModulePath string `json:"modulePath" form:"modulePath" query:"modulePath"`
	// The author of the plugin.
	//
	// example: jmattheis
	// read only: true
	Author string `json:"author,omitempty" form:"author" query:"author"`
	// The website of the plugin.
	//
	// example: gotify.net
	// read only: true
	Website string `json:"website,omitempty" form:"website" query:"website"`
	// The license of the plugin.
	//
	// example: MIT
	// read only: true
	License string `json:"license,omitempty" form:"license" query:"license"`
	// Whether the plugin instance is enabled.
	//
	// example: true
	// required: true
	Enabled bool `json:"enabled"`
	// Capabilities the plugin provides
	//
	// example: ["webhook","display"]
	// required: true
	Capabilities []string `json:"capabilities"`
}

PluginConfExternal Model

Holds information about a plugin instance for one user.

swagger:model PluginConf

type UpdateUserExternal added in v2.1.6

type UpdateUserExternal struct {
	// The user name. For login.
	//
	// required: true
	// example: unicorn
	Name string `binding:"required" json:"name" query:"name" form:"name"`
	// If the user is an administrator.
	//
	// required: true
	// example: true
	Admin bool `json:"admin" form:"admin" query:"admin"`
	// The user password. For login. Empty for using old password
	//
	// example: nrocinu
	Pass string `json:"pass,omitempty" form:"pass" query:"pass"`
}

UpdateUserExternal Model

Used for updating a user.

swagger:model UpdateUserExternal

type User

type User struct {
	ID           uint   `gorm:"primary_key;unique_index;AUTO_INCREMENT"`
	Name         string `gorm:"type:varchar(180);unique_index"`
	Pass         []byte
	Admin        bool
	Applications []Application
	Clients      []Client
	Plugins      []PluginConf
}

The User holds information about the credentials of a user and its application and client tokens.

type UserExternal

type UserExternal struct {
	// The user id.
	//
	// read only: true
	// required: true
	// example: 25
	ID uint `json:"id"`
	// The user name. For login.
	//
	// required: true
	// example: unicorn
	Name string `binding:"required" json:"name" query:"name" form:"name"`
	// If the user is an administrator.
	//
	// required: true
	// example: true
	Admin bool `json:"admin" form:"admin" query:"admin"`
}

UserExternal Model

The User holds information about permission and other stuff.

swagger:model User

type UserExternalPass

type UserExternalPass struct {
	// The user password. For login.
	//
	// required: true
	// example: nrocinu
	Pass string `json:"pass,omitempty" form:"pass" query:"pass" binding:"required"`
}

UserExternalPass Model

The Password for updating the user.

swagger:model UserPass

type VersionInfo

type VersionInfo struct {
	// The current version.
	//
	// required: true
	// example: 5.2.6
	Version string `json:"version"`
	// The git commit hash on which this binary was built.
	//
	// required: true
	// example: ae9512b6b6feea56a110d59a3353ea3b9c293864
	Commit string `json:"commit"`
	// The date on which this binary was built.
	//
	// required: true
	// example: 2018-02-27T19:36:10.5045044+01:00
	BuildDate string `json:"buildDate"`
}

VersionInfo Model

swagger:model VersionInfo

Jump to

Keyboard shortcuts

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