Documentation ¶
Index ¶
- Constants
- Variables
- type AllocateURLInput
- type AllocateURLOutput
- type ClipboardData
- type Code2ImgInput
- type Code2ImgOutput
- type GetFromUniversalClipboardInput
- type GetFromUniversalClipboardOutput
- type MIME
- type PingInput
- type PingOutput
- type PutToUniversalClipboardInput
- type PutToUniversalClipboardOutput
- type SourceType
- type WebsocketAction
- type WebsocketMessage
Constants ¶
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 ¶
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
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 ¶
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 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 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