From 046ec6380b7bb363e537ade7fd254b5505dde32d Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Sun, 16 Feb 2020 19:30:49 +0100 Subject: Some infrastructure --- mxlib/api.go | 18 ++++++++++++++++++ mxlib/registration.go | 25 +++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 mxlib/api.go create mode 100644 mxlib/registration.go (limited to 'mxlib') diff --git a/mxlib/api.go b/mxlib/api.go new file mode 100644 index 0000000..59e1267 --- /dev/null +++ b/mxlib/api.go @@ -0,0 +1,18 @@ +package mxlib + +import ( + _ "encoding/json" +) + +type Transaction struct { + Events []Event `json:"events"` +} + +type Event struct { + Content map[string]string `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"` +} diff --git a/mxlib/registration.go b/mxlib/registration.go new file mode 100644 index 0000000..d4b18dc --- /dev/null +++ b/mxlib/registration.go @@ -0,0 +1,25 @@ +package mxlib + +import ( + _ "gopkg.in/yaml.v2" +) + +type Registration struct { + Id string `yaml:"id"` + Url string `yaml:"url"` + AsToken string `yaml:"as_token"` + HsToken string `yaml:"hs_token"` + SenderLocalpart string `yaml:"sender_localpart"` + Namespaces RegistrationNamespaceSet `yaml:"namespaces"` +} + +type RegistrationNamespaceSet struct { + Users []RegistrationNamespace `yaml:"users"` + Aliases []RegistrationNamespace `yaml:"aliases"` + Rooms []RegistrationNamespace `yaml:"rooms"` +} + +type RegistrationNamespace struct { + Exclusive bool `yaml:"exclusive"` + Regex string `yaml:"regex"` +} -- cgit v1.2.3