Documentation ¶
Overview ¶
Package helping with the communication between bots and WebXDC apps via JSON-RPC 1.0
Index ¶
- func GetUpdate(rpc *deltachat.Rpc, accId deltachat.AccountId, msgId deltachat.MsgId, ...) (json.RawMessage, error)
- func GetUpdates(rpc *deltachat.Rpc, accId deltachat.AccountId, msgId deltachat.MsgId, ...) ([]json.RawMessage, error)
- func HandleMessage(rpc *deltachat.Rpc, accId deltachat.AccountId, msgId deltachat.MsgId, ...) error
- func IsFromSelf(rawUpdate []byte) bool
- func SendPayload[T any](rpc *deltachat.Rpc, accId deltachat.AccountId, msgId deltachat.MsgId, ...) error
- func SendUpdate[T any](rpc *deltachat.Rpc, accId deltachat.AccountId, msgId deltachat.MsgId, ...) error
- type Error
- type ErrorCode
- type Request
- type Response
- type SelfMessageErr
- type StatusUpdate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetUpdate ¶
func GetUpdate(rpc *deltachat.Rpc, accId deltachat.AccountId, msgId deltachat.MsgId, serial uint) (json.RawMessage, error)
Get the status update with the given serial
func GetUpdates ¶
func GetUpdates(rpc *deltachat.Rpc, accId deltachat.AccountId, msgId deltachat.MsgId, serial uint) ([]json.RawMessage, error)
Get all setatus updates with serial greater than the given serial
func HandleMessage ¶
func IsFromSelf ¶
Return true if the raw status update is from self, false otherwise
Types ¶
type Error ¶
type Error struct { Code ErrorCode `json:"code,omitempty"` Message string `json:"message,omitempty"` Data any `json:"data,omitempty"` }
Error data sent by the bot in ErrorResponse
type ErrorCode ¶
type ErrorCode int
const ( // The method does not exist / is not available MethodNotFoud ErrorCode = -32601 // Invalid JSON was received by the server ParseError ErrorCode = -32700 // The JSON sent is not a valid Request object InvalidRequest ErrorCode = -32600 // Invalid method parameter(s) InvalidParams ErrorCode = -32602 )
type Request ¶
type Request struct { Id string `json:"id,omitempty"` Method string `json:"method"` Params []any `json:"params"` }
Request sent by the frontend app
type Response ¶
type Response struct { Id string `json:"id,omitempty"` Result any `json:"result"` Error *Error `json:"error"` }
Response sent by the bot
func GetResponse ¶
type SelfMessageErr ¶
type SelfMessageErr struct { }
func (*SelfMessageErr) Error ¶
func (self *SelfMessageErr) Error() string
Click to show internal directories.
Click to hide internal directories.