easybridge/mxlib/api.go

112 lines
2.9 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"`
2020-02-17 18:02:26 +00:00
ErrMsg string `json:"error"`
2020-02-16 21:07:41 +00:00
}
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-17 18:02:26 +00:00
Content map[string]interface{} `json:"content"`
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 18:30:49 +00:00
}
2020-02-16 21:07:41 +00:00
2020-02-26 16:45:25 +00:00
type PasswordLoginRequest struct {
Type string `json:"type"`
Identifier map[string]string `json:"identifier"`
Password string `json:"password"`
DeviceID string `json:"device_id"`
InitialDeviceDisplayNAme string `json:"initial_device_display_name"`
}
type LoginResponse struct {
UserID string `json:"user_id"`
AccessToken string `json:"access_token"`
}
2020-02-16 21:07:41 +00:00
type RegisterRequest struct {
Auth RegisterRequestAuth `json:"auth"`
Username string `json:"username"`
}
type RegisterRequestAuth struct {
Type string `json:"type"`
2020-02-16 21:07:41 +00:00
}
type RegisterResponse struct {
2020-02-17 18:02:26 +00:00
UserId string `json:"user_id"`
2020-02-16 21:07:41 +00:00
AccessToken string `json:"access_token"`
2020-02-17 18:02:26 +00:00
DeviceId string `json:"device_id"`
2020-02-16 21:07:41 +00:00
}
type ProfileDisplaynameRequest struct {
Displayname string `json:"displayname"`
}
type CreateRoomRequest struct {
2020-02-17 18:02:26 +00:00
Preset string `json:"preset"`
RoomAliasName string `json:"room_alias_name"`
Name string `json:"name"`
Topic string `json:"topic"`
Invite []string `json:"invite"`
2020-02-16 21:07:41 +00:00
CreationContent map[string]interface{} `json:"creation_content"`
2020-02-17 18:02:26 +00:00
PowerLevels map[string]interface{} `json:"power_level_content_override"`
2020-02-16 21:57:30 +00:00
}
2020-02-18 17:14:48 +00:00
type CreateDirectRoomRequest struct {
2020-02-17 18:02:26 +00:00
Preset string `json:"preset"`
Topic string `json:"topic"`
Invite []string `json:"invite"`
2020-02-16 21:57:30 +00:00
CreationContent map[string]interface{} `json:"creation_content"`
2020-02-17 18:02:26 +00:00
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 {
2020-02-17 18:02:26 +00:00
RoomId string `json:"room_id"`
2020-02-16 21:07:41 +00:00
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"`
}
type RoomSendResponse struct {
EventId string `json:"event_id"`
}
2020-02-21 14:12:22 +00:00
type UploadResponse struct {
ContentUri string `json:"content_uri"`
}
type ProfileAvatarUrl struct {
AvatarUrl string `json:"avatar_url"`
}