From 2af37d47783aac8c650ffd1578e2297b5784c73d Mon Sep 17 00:00:00 2001 From: r Date: Tue, 28 Jan 2020 17:51:00 +0000 Subject: Refactor everything --- model/app.go | 2 +- model/client.go | 7 ++++++- model/post.go | 19 +++++++++++++++++++ model/postContext.go | 19 ------------------- model/session.go | 2 +- 5 files changed, 27 insertions(+), 22 deletions(-) create mode 100644 model/post.go delete mode 100644 model/postContext.go (limited to 'model') diff --git a/model/app.go b/model/app.go index 7abc8ec..8f172c8 100644 --- a/model/app.go +++ b/model/app.go @@ -15,7 +15,7 @@ type App struct { ClientSecret string `json:"client_secret"` } -type AppRepository interface { +type AppRepo interface { Add(app App) (err error) Get(instanceDomain string) (app App, err error) } diff --git a/model/client.go b/model/client.go index ae7270e..6123b38 100644 --- a/model/client.go +++ b/model/client.go @@ -1,8 +1,13 @@ package model -import "mastodon" +import ( + "io" + + "mastodon" +) type Client struct { *mastodon.Client + Writer io.Writer Session Session } diff --git a/model/post.go b/model/post.go new file mode 100644 index 0000000..58997f7 --- /dev/null +++ b/model/post.go @@ -0,0 +1,19 @@ +package model + +type PostFormat struct { + Name string + Type string +} + +type PostContext struct { + DefaultVisibility string + ReplyContext *ReplyContext + Formats []PostFormat + DarkMode bool +} + +type ReplyContext struct { + InReplyToID string + InReplyToName string + ReplyContent string +} diff --git a/model/postContext.go b/model/postContext.go deleted file mode 100644 index 58997f7..0000000 --- a/model/postContext.go +++ /dev/null @@ -1,19 +0,0 @@ -package model - -type PostFormat struct { - Name string - Type string -} - -type PostContext struct { - DefaultVisibility string - ReplyContext *ReplyContext - Formats []PostFormat - DarkMode bool -} - -type ReplyContext struct { - InReplyToID string - InReplyToName string - ReplyContent string -} diff --git a/model/session.go b/model/session.go index 6bc8a63..10fca6f 100644 --- a/model/session.go +++ b/model/session.go @@ -16,7 +16,7 @@ type Session struct { Settings Settings `json:"settings"` } -type SessionRepository interface { +type SessionRepo interface { Add(session Session) (err error) Get(sessionID string) (session Session, err error) } -- cgit v1.2.3