Add API client lib

This commit is contained in:
Daniel 2019-03-08 23:19:08 +01:00
parent ff4248822b
commit 601b1384d1
5 changed files with 566 additions and 0 deletions

30
api/client/const.go Normal file
View file

@ -0,0 +1,30 @@
package client
// message types
const (
msgRequestGet = "get"
msgRequestQuery = "query"
msgRequestSub = "sub"
msgRequestQsub = "qsub"
msgRequestCreate = "create"
msgRequestUpdate = "update"
msgRequestInsert = "insert"
msgRequestDelete = "delete"
MsgOk = "ok"
MsgError = "error"
MsgDone = "done"
MsgSuccess = "success"
MsgUpdate = "upd"
MsgNew = "new"
MsgDelete = "del"
MsgWarning = "warning"
MsgOffline = "offline" // special message type for signaling the handler that the connection was lost
apiSeperator = "|"
)
var (
apiSeperatorBytes = []byte(apiSeperator)
)