model

package
v3.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: CC-BY-4.0, MIT Imports: 1 Imported by: 0

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

View Source
var DefaultElevationDuration = time.Hour

Functions

This section is empty.

Types

type Application

type Application struct {
	// The application id.
	//
	// read only: true
	// required: true
	// example: 5
	ID uint `gorm:"primaryKey;autoIncrement" json:"id"`
	// The application token. Can be used as `appToken`. See Authentication.
	//
	// read only: true
	// example: AWH0wZ5r0Mbac.r
	Token  string `gorm:"type:varchar(180);uniqueIndex:uix_applications_token" json:"token,omitempty"`
	UserID uint   `gorm:"index;uniqueIndex:uix_application_user_id_sort_key,priority:1" 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 `gorm:"-" json:"-"`
	// The default priority of messages sent by this application. Defaults to 0.
	//
	// required: false
	// example: 4
	DefaultPriority int `form:"defaultPriority" query:"defaultPriority" json:"defaultPriority"`
	// The date the application was created.
	//
	// read only: true
	// required: true
	// example: 2019-01-01T00:00:00Z
	CreatedAt time.Time `json:"createdAt"`
	// The last time the application token was used.
	//
	// read only: true
	// example: 2019-01-01T00:00:00Z
	LastUsed *time.Time `json:"lastUsed"`
	// The sort key of this application. Uses fractional indexing.
	//
	// required: true
	// example: a1
	SortKey string `` /* 130-byte string literal not displayed */
}

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:"primaryKey;autoIncrement" json:"id"`
	// The client token. Can be used as `clientToken`. See Authentication.
	//
	// read only: true
	// example: CWH0wZ5r0Mbac.r
	Token  string `gorm:"type:varchar(180);uniqueIndex:uix_clients_token" json:"token,omitempty"`
	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"`
	// The date the client was created.
	//
	// read only: true
	// required: true
	// example: 2019-01-01T00:00:00Z
	CreatedAt time.Time `json:"createdAt"`
	// The last time the client token was used.
	//
	// read only: true
	// example: 2019-01-01T00:00:00Z
	LastUsed *time.Time `json:"lastUsed"`
	// The time until which this client's session is elevated.
	//
	// read only: true
	ElevatedUntil *time.Time `json:"elevatedUntil,omitempty"`
	// The number of seconds of inactivity after which the client is removed.
	// 0 means the client never expires.
	//
	// example: 2592000
	ExpiresAfterInactivitySeconds uint `` /* 137-byte string literal not displayed */
	// The time at which this client will expire due to inactivity, or null if it never expires.
	//
	// read only: true
	// example: 2019-01-01T00:00:00Z
	ExpiresAt *time.Time `gorm:"index" json:"expiresAt,omitempty"`
}

Client Model

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

swagger:model Client

func (*Client) PopulateExpiresAt

func (c *Client) PopulateExpiresAt()

type CreateMessage

type CreateMessage struct {
	// The application id that send this message. Always set when returned via the API.
	//
	// example: 5
	ApplicationID uint `form:"appid" query:"appid" 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. If unset, then the default priority of the
	// application will be used.
	//
	// 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]any `form:"-" query:"-" json:"extras,omitempty"`
}

CreateMessage Model

The CreateMessage holds information about a message that will be sent.

swagger:model CreateMessage

type CreateUserExternal

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 CurrentUserExternal

type CurrentUserExternal 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 `json:"name"`
	// If the user is an administrator.
	//
	// required: true
	// example: true
	Admin bool `json:"admin"`
	// The date the user was created.
	//
	// read only: true
	// required: true
	// example: 2019-01-01T00:00:00Z
	CreatedAt time.Time `json:"createdAt"`
	// The client id of the current session.
	//
	// read only: true
	// example: 5
	ClientID uint `json:"clientId,omitempty"`
	// The time until which the session is elevated.
	//
	// read only: true
	ElevatedUntil *time.Time `json:"elevatedUntil,omitempty"`
}

CurrentUserExternal Model

swagger:model CurrentUser

type ElevateRequest

type ElevateRequest struct {
	// How long the elevation should last, in seconds.
	//
	// required: true
	// example: 900
	DurationSeconds int `form:"durationSeconds" query:"durationSeconds" json:"durationSeconds" binding:"required"`
}

ElevateRequest parameters for client elevation.

swagger:model ElevateRequest

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 GotifyInfo

type GotifyInfo struct {
	// The current version.
	//
	// required: true
	// example: 5.2.6
	Version string `json:"version"`
	// If registration is enabled.
	//
	// required: true
	// example: true
	Register bool `json:"register"`
	// If local authentication is enabled.
	//
	// required: true
	// example: true
	LocalAuth bool `json:"localAuth"`
	// If oidc is enabled.
	//
	// required: true
	// example: true
	Oidc bool `json:"oidc"`
	// Name of the OIDC identity provider.
	//
	// required: true
	// example: OIDC
	OIDCIDPName string `json:"oidcIdpName"`
	// If the WebUI should automatically redirect to the OIDC identity
	// provider instead of showing the login page.
	//
	// required: true
	// example: false
	OIDCAutoRedirect bool `json:"oidcAutoRedirect"`
}

GotifyInfo Model

swagger:model GotifyInfo

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:"autoIncrement;primaryKey;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 `form:"appid" query:"appid" 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. If unset, then the default priority of the
	// application will be used.
	//
	// 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]any `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 OIDCExternalAuthorizeRequest

type OIDCExternalAuthorizeRequest struct {
	// The PKCE code challenge (S256).
	//
	// required: true
	// example: E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM
	CodeChallenge string `json:"code_challenge" binding:"required"`
	// The app's redirect URI.
	//
	// required: true
	// example: gotify://oidc/callback
	RedirectURI string `json:"redirect_uri" binding:"required"`
	// The client name to display in gotify.
	//
	// required: true
	// example: Android Phone
	Name string `json:"name" binding:"required"`
}

OIDCExternalAuthorizeRequest Model

Used to initiate the OIDC authorization flow for an external client.

swagger:model OIDCExternalAuthorizeRequest

type OIDCExternalAuthorizeResponse

type OIDCExternalAuthorizeResponse struct {
	// The URL to open in the browser to authenticate with the OIDC provider.
	//
	// required: true
	// example: https://auth.example.com/authorize?client_id=gotify&...
	AuthorizeURL string `json:"authorize_url"`
	// The state parameter to send back with the token exchange request.
	//
	// required: true
	// example: Android Phone:a1b2c3d4e5f6
	State string `json:"state"`
}

OIDCExternalAuthorizeResponse Model

Returned after initiating the OIDC authorization flow.

swagger:model OIDCExternalAuthorizeResponse

type OIDCExternalTokenRequest

type OIDCExternalTokenRequest struct {
	// The authorization code from the OIDC provider.
	//
	// required: true
	Code string `json:"code" binding:"required"`
	// The state from the authorize response.
	//
	// required: true
	// example: Android Phone:a1b2c3d4e5f6
	State string `json:"state" binding:"required"`
	// The PKCE code verifier.
	//
	// required: true
	// example: dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk
	CodeVerifier string `json:"code_verifier" binding:"required"`
}

OIDCExternalTokenRequest Model

Used to exchange an authorization code for a gotify client token.

swagger:model OIDCExternalTokenRequest

type OIDCExternalTokenResponse

type OIDCExternalTokenResponse struct {
	// The gotify client token for API authentication.
	//
	// required: true
	// example: CWH0wZ5r0Mbac.r
	Token string `json:"token"`
	// The authenticated user.
	//
	// required: true
	User *UserExternal `json:"user"`
}

OIDCExternalTokenResponse Model

Returned after a successful token exchange.

swagger:model OIDCExternalTokenResponse

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 relative path for the next page. Empty/Null when no next page is available. Should be combined with the gotify base url.
	//
	// read only: true
	// required: false
	// example: /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:"primaryKey;autoIncrement"`
	UserID        uint
	ModulePath    string `gorm:"type:text"`
	Token         string `gorm:"type:varchar(180);uniqueIndex:uix_plugin_confs_token"`
	ApplicationID uint
	Enabled       bool
	CreatedAt     time.Time
	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 date the plugin was created.
	//
	// read only: true
	// required: true
	// example: 2019-01-01T00:00:00Z
	CreatedAt time.Time `json:"createdAt"`
	// 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 RegenerateTokenResponse

type RegenerateTokenResponse struct {
	// The new token.
	//
	// example: gtfya.e2NcJK7AenXBPIRB3S03JsBlmy0V6xP8h0hwSiAJae8
	// read only: true
	// required: true
	Token string `json:"token"`
}

RegenerateTokenResponse Model

The RegenerateTokenResponse holds information about the response to the regenerate token action.

swagger:model RegenerateTokenResponse

type SecurityUpdateAction

type SecurityUpdateAction struct {
	// Whether to regenerate the token. Your client token must be elevated to perform this action.
	//
	// example: true
	RegenerateToken bool `form:"regenerateToken" query:"regenerateToken" json:"regenerateToken"`
}

SecurityUpdateAction Model

The SecurityUpdateAction describes the details of a requested security update.

swagger:model SecurityUpdateAction

type SecurityUpdateActionResponse

type SecurityUpdateActionResponse struct {
	// The response to the regenerate token action. Only present if the regenerate token action was requested.
	RegenerateToken *RegenerateTokenResponse `json:"regenerateToken,omitempty"`
}

SecurityUpdateActionResponse Model

The SecurityUpdateActionResponse holds information about the response to a security update request.

swagger:model SecurityUpdateActionResponse

type UpdateUserExternal

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:"primaryKey;autoIncrement"`
	Name         string `gorm:"type:varchar(180);uniqueIndex:uix_users_name"`
	Pass         []byte
	Admin        bool
	CreatedAt    time.Time
	Applications []Application
	Clients      []Client
	Plugins      []PluginConf
	// Format: OIDC claims combined as "<iss>#<sub>".
	OIDCID *string `gorm:"column:oidc_id;type:text;uniqueIndex:uix_users_oidc_id,length:512"`
}

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"`
	// The date the user was created.
	//
	// read only: true
	// required: true
	// example: 2019-01-01T00:00:00Z
	CreatedAt time.Time `json:"createdAt"`
}

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