From f7eb4f7e28b61106ff887228da4b9d7fed869ca4 Mon Sep 17 00:00:00 2001 From: nxshock Date: Sat, 10 Aug 2019 10:47:09 +0500 Subject: [PATCH] Move event types to common --- internal/models/common/event.go | 44 +++++++++++++++++++++++++++++++++ internal/models/rooms/rooms.go | 44 --------------------------------- 2 files changed, 44 insertions(+), 44 deletions(-) diff --git a/internal/models/common/event.go b/internal/models/common/event.go index 8fa41bc..790a89d 100644 --- a/internal/models/common/event.go +++ b/internal/models/common/event.go @@ -12,6 +12,50 @@ const ( MembershipBan Membership = "ban" ) +// Type is type of event +type EventType string + +const ( + // https://matrix.org/docs/spec/client_server/latest#m-room-aliases + Aliases EventType = "m.room.aliases" + + // https://matrix.org/docs/spec/client_server/latest#m-room-canonical-alias + CanonicalAlias EventType = "m.room.canonical_alias" + + // https://matrix.org/docs/spec/client_server/latest#m-room-create + Create EventType = "m.room.create" + + // https://matrix.org/docs/spec/client_server/latest#m-room-join-rules + JoinRules EventType = "m.room.join_rules" + + // https://matrix.org/docs/spec/client_server/latest#m-room-member + Member EventType = "m.room.member" + + // https://matrix.org/docs/spec/client_server/latest#m-room-power-levels + PowerLevels EventType = "m.room.power_levels" + + // https://matrix.org/docs/spec/client_server/latest#m-room-redaction + Redaction EventType = "m.room.redaction" + + // https://matrix.org/docs/spec/client_server/latest#m-room-message + Message EventType = "m.room.message" + + // https://matrix.org/docs/spec/client_server/latest#m-room-message-feedback + MessageFeedback EventType = "m.room.message.feedback" + + // https://matrix.org/docs/spec/client_server/latest#m-room-name + Name EventType = "m.room.name" + + // https://matrix.org/docs/spec/client_server/latest#m-room-topic + Topic EventType = "m.room.topic" + + // https://matrix.org/docs/spec/client_server/latest#m-room-avatar + Avatar EventType = "m.room.avatar" + + // https://matrix.org/docs/spec/client_server/latest#m-room-pinned-events + PinnedEvents EventType = "m.room.pinned_events" +) + type Event struct { // TODO: object Content json.RawMessage `json:"content"` // Required. The fields in this object will vary depending on the type of event. When interacting with the REST API, this is the HTTP body. diff --git a/internal/models/rooms/rooms.go b/internal/models/rooms/rooms.go index 912e47e..a5ee53d 100644 --- a/internal/models/rooms/rooms.go +++ b/internal/models/rooms/rooms.go @@ -6,50 +6,6 @@ import ( "github.com/signaller-matrix/signaller/internal/models/events" ) -// Type is type of event -type Type string - -const ( - // https://matrix.org/docs/spec/client_server/latest#m-room-aliases - Aliases Type = "m.room.aliases" - - // https://matrix.org/docs/spec/client_server/latest#m-room-canonical-alias - CanonicalAlias = "m.room.canonical_alias" - - // https://matrix.org/docs/spec/client_server/latest#m-room-create - Create = "m.room.create" - - // https://matrix.org/docs/spec/client_server/latest#m-room-join-rules - JoinRules = "m.room.join_rules" - - // https://matrix.org/docs/spec/client_server/latest#m-room-member - Member = "m.room.member" - - // https://matrix.org/docs/spec/client_server/latest#m-room-power-levels - PowerLevels = "m.room.power_levels" - - // https://matrix.org/docs/spec/client_server/latest#m-room-redaction - Redaction = "m.room.redaction" - - // https://matrix.org/docs/spec/client_server/latest#m-room-message - Message = "m.room.message" - - // https://matrix.org/docs/spec/client_server/latest#m-room-message-feedback - MessageFeedback = "m.room.message.feedback" - - // https://matrix.org/docs/spec/client_server/latest#m-room-name - Name = "m.room.name" - - // https://matrix.org/docs/spec/client_server/latest#m-room-topic - Topic = "m.room.topic" - - // https://matrix.org/docs/spec/client_server/latest#m-room-avatar - Avatar = "m.room.avatar" - - // https://matrix.org/docs/spec/client_server/latest#m-room-pinned-events - PinnedEvents = "m.room.pinned_events" -) - type JoinRule string const (