easybridge/mxlib/api.go

92 lines
2 KiB
Go
Raw Normal View History

2020-02-16 18:30:49 +00:00
package mxlib
import (
_ "encoding/json"
)
2020-02-16 21:07:41 +00:00
type MxError struct {
ErrCode string `json:"errcode"`
ErrMsg string `json:"error"`
}
func (e *MxError) Error() string {
return e.ErrMsg
}
2020-02-16 18:30:49 +00:00
type Transaction struct {
Events []Event `json:"events"`
}
type Event struct {
2020-02-16 21:57:30 +00:00
Content map[string]interface{} `json:"content"`
2020-02-16 18:30:49 +00:00
Type string `json:"type"`
EventId string `json:"event_id"`
RoomId string `json:"room_id"`
Sender string `json:"sender"`
OriginServerTs int `json:"origin_server_ts"`
}
2020-02-16 21:07:41 +00:00
type RegisterRequest struct {
Username string `json:"username"`
}
type RegisterResponse struct {
UserId string `json:"user_id"`
AccessToken string `json:"access_token"`
DeviceId string `json:"device_id"`
}
type ProfileDisplaynameRequest struct {
Displayname string `json:"displayname"`
}
type CreateRoomRequest struct {
Preset string `json:"preset"`
RoomAliasName string `json:"room_alias_name"`
Name string `json:"name"`
Topic string `json:"topic"`
Invite []string `json:"invite"`
CreationContent map[string]interface{} `json:"creation_content"`
2020-02-16 21:57:30 +00:00
PowerLevels map[string]interface{} `json:"power_level_content_override"`
}
type CreateRoomNoAliasRequest struct {
Preset string `json:"preset"`
Name string `json:"name"`
Topic string `json:"topic"`
Invite []string `json:"invite"`
CreationContent map[string]interface{} `json:"creation_content"`
PowerLevels map[string]interface{} `json:"power_level_content_override"`
IsDirect bool `json:"is_direct"`
2020-02-16 21:07:41 +00:00
}
type CreateRoomResponse struct {
RoomId string `json:"room_id"`
}
type DirectoryRoomResponse struct {
RoomId string `json:"room_id"`
Servers []string `json:"string"`
}
type RoomInviteRequest struct {
UserId string `json:"user_id"`
}
type RoomKickRequest struct {
UserId string `json:"user_id"`
Reason string `json:"reason"`
}
type RoomJoinResponse struct {
RoomId string `json:"room_id"`
}
2020-02-16 21:57:30 +00:00
type RoomSendMessageRequest struct {
2020-02-16 21:07:41 +00:00
MsgType string `json:"msgtype"`
Body string `json:"body"`
}
type RoomSendResponse struct {
EventId string `json:"event_id"`
}
2020-02-16 21:57:30 +00:00