api

package
v2.0.0-...-3e2c818 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Docs []ApiEntry = []ApiEntry{
	{Api: "/group/create", OtherParams: []string{"data"}, ReturnValue: "group id"},
	{Api: "/group/push", StringParams: []string{"group", "author", "title", "content", "when"}, OtherParams: []string{"ids of pushed sessions"}},
	{Api: "/group/setdata", StringParams: []string{"group"}, OtherParams: []string{"data"}, ReturnValue: "empty"},
	{Api: "/session/create", StringParams: []string{"group", "hook", "data"}, ReturnValue: "session id"},
	{Api: "/session/push", StringParams: []string{"session", "author", "title", "content", "when"}, ReturnValue: "empty"},
	{Api: "/session/check", StringParams: []string{"session"}, ReturnValue: "session info"},
	{Api: "/session/setdata", StringParams: []string{"session"}, OtherParams: []string{"data"}, ReturnValue: "empty"},
	{Api: "/session/hide", StringParams: []string{"session"}, ReturnValue: "empty"},
}

Functions

func JobGetter

func JobGetter(t string, m bson.M) (database.Job, error)

func ScheduleGetter

func ScheduleGetter(t string, m bson.M) (database.Schedule, error)

Types

type ApiEntry

type ApiEntry struct {
	Api          string   `json:"api:omitempty"`
	StringParams []string `json:"string_params:omitempty"`
	OtherParams  []string `json:"other_params:omitempty"`
	ReturnValue  any      `json:"return_value:omitempty"`
}

type Group

type Group struct {
	database.Group
}

func (Group) Push

func (g Group) Push(m *Message) ([]pushResp, error)

func (Group) PushWhen

func (g Group) PushWhen(m *Message, t time.Time, sc *scheduler.Scheduler) error

func (Group) WsgoH

func (g Group) WsgoH() wsgo.H

func (Group) WsgoHWithSessions

func (g Group) WsgoHWithSessions() wsgo.H

type Message

type Message struct {
	Author  string
	Title   string
	Content string
}

type OneTimeSchedule

type OneTimeSchedule struct {
	scheduler.OneTimeSchedule
}

func NewOneTimeSchedule

func NewOneTimeSchedule(t time.Time) *OneTimeSchedule

func (*OneTimeSchedule) GetType

func (s *OneTimeSchedule) GetType() string

func (*OneTimeSchedule) IsType

func (s *OneTimeSchedule) IsType(t string) bool

func (*OneTimeSchedule) Load

func (s *OneTimeSchedule) Load(m bson.M) error

func (*OneTimeSchedule) Save

func (s *OneTimeSchedule) Save() (bson.M, error)

type PushToSessionJob

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

func NewPushToSessionJob

func NewPushToSessionJob(url string, data []byte) *PushToSessionJob

func (*PushToSessionJob) GetType

func (j *PushToSessionJob) GetType() string

func (*PushToSessionJob) IsType

func (j *PushToSessionJob) IsType(t string) bool

func (*PushToSessionJob) Load

func (j *PushToSessionJob) Load(m bson.M) error

func (*PushToSessionJob) Run

func (j *PushToSessionJob) Run()

func (*PushToSessionJob) Save

func (j *PushToSessionJob) Save() (bson.M, error)

type Server

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

func NewServer

func NewServer(db database.Database) Server

func (*Server) Serve

func (s *Server) Serve() error

func (*Server) SetAddr

func (s *Server) SetAddr(addr string)

func (*Server) SetPrefix

func (s *Server) SetPrefix(p string)

type Session

type Session struct {
	database.Session
}

func (Session) Push

func (s Session) Push(m *Message) (*http.Response, error)

func (Session) PushWhen

func (s Session) PushWhen(m *Message, t time.Time, sc *scheduler.Scheduler) error

func (Session) WsgoH

func (s Session) WsgoH() wsgo.H

func (Session) WsgoHWithGroup

func (s Session) WsgoHWithGroup() wsgo.H

Jump to

Keyboard shortcuts

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