types

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2024 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActionNone                WebsocketAction = "none"
	ActionHandshakeRegister                   = "register"
	ActionHandshakeReady                      = "ready"
	ActionClipboardChanged                    = "cbchanged"
	ActionClipboardGet                        = "cbget"
	ActionClipboardPut                        = "cbput"
	ActionListDaemonsRequest                  = "lsdaemonreq"
	ActionListDaemonsResponse                 = "lsdaemonsres"
	ActionTerminate                           = "terminate"
)

All actions from daemons

Variables

View Source
var (
	EndpointClipboard   = config.Get().Domain + "/midgard/api/v1/clipboard"
	EndpointAllocateURL = config.Get().Domain + "/midgard/api/v1/allocate"
	EndpointCode2Image  = config.Get().Domain + "/midgard/api/v1/code2img"
	EndpointSubscribe   = config.Get().Domain + "/midgard/api/v1/ws"
)

Endpoints

View Source
var (
	ErrBadAction = errors.New("bad action data")
)

Errors

Functions

This section is empty.

Types

type AllocateURLInput

type AllocateURLInput struct {
	Source SourceType `json:"source"`
	URI    string     `json:"uri"`
	Data   string     `json:"data"`
}

AllocateURLInput defines the input format of requested resource

type AllocateURLOutput

type AllocateURLOutput struct {
	URL     string `json:"url"`
	Message string `json:"msg"`
}

AllocateURLOutput ...

type ClipboardData

type ClipboardData struct {
	Type MIME   `json:"type"`
	Data string `json:"data"` // base64 encode if type is an image data
}

ClipboardData is a clipboard data

type Code2ImgInput

type Code2ImgInput struct {
	Code string `json:"code"`
}

Code2ImgInput ...

type Code2ImgOutput

type Code2ImgOutput struct {
	Code    string `json:"code"`
	Image   string `json:"img"`
	Message string `json:"msg"`
}

Code2ImgOutput ...

type GetFromUniversalClipboardInput

type GetFromUniversalClipboardInput struct {
}

GetFromUniversalClipboardInput is the standard input format of the universal clipboard put request.

type GetFromUniversalClipboardOutput

type GetFromUniversalClipboardOutput ClipboardData

GetFromUniversalClipboardOutput is the standard output format of the universal clipboard put request.

type MIME

type MIME string

MIME indicates clipboard data type

Note: We use string for the data type because this is better for post body in iOS shortcut.

const (
	// MIMEPlainText indicates plain text data type
	MIMEPlainText MIME = "text"
	// MIMEImagePNG indicates image/png data type
	MIMEImagePNG = "image/png"
)

type PingInput

type PingInput struct{}

PingInput is the input for /ping

type PingOutput

type PingOutput struct {
	Version   string `json:"version"`
	GoVersion string `json:"go_version"`
	BuildTime string `json:"build_time"`
}

PingOutput is the output for /ping

type PutToUniversalClipboardInput

type PutToUniversalClipboardInput struct {
	ClipboardData
	DaemonID string `json:"daemon_id"`
}

PutToUniversalClipboardInput is the standard input format of the universal clipboard put request.

type PutToUniversalClipboardOutput

type PutToUniversalClipboardOutput struct {
	Message string `json:"msg"`
}

PutToUniversalClipboardOutput is the standard output format of the universal clipboard put request.

type SourceType

type SourceType string

SourceType is the source type for URL allocation.

Note: We use string for the data type because this is better for post body in iOS shortcut.

const (
	// SourceUniversalClipboard indicates source from clipboard
	SourceUniversalClipboard SourceType = "clipboard"
	// SourceAttachment indicates source from attachment
	SourceAttachment = "attachment"
)

type WebsocketAction

type WebsocketAction string

WebsocketAction is an action between midgard daemon and midgard server

type WebsocketMessage

type WebsocketMessage struct {
	Action  WebsocketAction `json:"action"`
	UserID  string          `json:"user_id"`
	Message string          `json:"msg"`
	Data    []byte          `json:"data"` // action dependent data, json format
}

WebsocketMessage represents a message for websocket.

func (*WebsocketMessage) Decode

func (m *WebsocketMessage) Decode(data []byte) error

Decode decodes given data to m.

func (*WebsocketMessage) Encode

func (m *WebsocketMessage) Encode() []byte

Encode encodes a websocket message

Directories

Path Synopsis
Package proto defines the midgard gRPC protocols.
Package proto defines the midgard gRPC protocols.

Jump to

Keyboard shortcuts

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