From ec51d18cd6b6b9190e9e1e6c78f3a31abdc723cf Mon Sep 17 00:00:00 2001 From: Nikita Tokarchuk Date: Fri, 3 Dec 2021 03:41:37 +0100 Subject: [PATCH] Add ghost client interface --- frontend/ghost/data.go | 9 +++++++++ frontend/ghost/ghost.go | 8 ++++++++ frontend/ghost/params.go | 10 ++++++++++ 3 files changed, 27 insertions(+) create mode 100644 frontend/ghost/data.go create mode 100644 frontend/ghost/ghost.go create mode 100644 frontend/ghost/params.go diff --git a/frontend/ghost/data.go b/frontend/ghost/data.go new file mode 100644 index 0000000..b7baf28 --- /dev/null +++ b/frontend/ghost/data.go @@ -0,0 +1,9 @@ +package ghost + +// Pages are ghost pages data +type Pages struct { +} + +// Posts are ghost posts data +type Posts struct { +} diff --git a/frontend/ghost/ghost.go b/frontend/ghost/ghost.go new file mode 100644 index 0000000..b9d4944 --- /dev/null +++ b/frontend/ghost/ghost.go @@ -0,0 +1,8 @@ +package ghost + +// Client is the ghost backend client +type Client interface { + GetPosts(params ...QueryParam) (posts *Posts, err error) + GetPostBySlug(slug string, params ...QueryParam) (posts *Posts, err error) + GetPageBySlug(slug string) (pages *Pages, err error) +} diff --git a/frontend/ghost/params.go b/frontend/ghost/params.go new file mode 100644 index 0000000..c6c23b6 --- /dev/null +++ b/frontend/ghost/params.go @@ -0,0 +1,10 @@ +package ghost + +import ( + "github.com/valyala/fasthttp" +) + +// QueryParam is the generic query param applier +type QueryParam interface { + Apply(headers *fasthttp.RequestHeader, args *fasthttp.Args) +}