aboutsummaryrefslogtreecommitdiff
path: root/mxlib/api.go
blob: de5b42445c17f3243c607cafd6188043497da941 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
package mxlib

import (
	_ "encoding/json"
)

type MxError struct {
	ErrCode string `json:"errcode"`
	ErrMsg string `json:"error"`
}

func (e *MxError) Error() string {
	return e.ErrMsg
}

type Transaction struct {
	Events []Event `json:"events"`
}

type Event struct {
	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"`
}

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"`
	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"`
}

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"`
}

type RoomSendResponse struct {
	EventId string `json:"event_id"`
}