This module contains all functions to access any kind of ghost related
resource, these are Config
,
Author
s, Error
s, Mata
, Post
s, Settings
s, Tag
s.
See https://docs.ghost.org/api/content/#resources
Author
A record for all author related information.
{ url : String
, key : String
, version : String
}
A record for the basic ghost configuration:
Config url key "v2"
The version currently is always "v2", which might change later. The key to access the api has to be generated as described in:
https://docs.ghost.org/api/content/#key
A Ghost Error is a combined type of GhostError
and HttpError
.
Meta
Meta
information are part of every HTTP response, except for settings
and contain pagination related information:
https://docs.ghost.org/api/content/#pagination
Post
A record for all post related information.
Settings
A record for all setting related information.
Tag
A record for all tag related information.
authors : Config -> (Result Error ( List Author, Meta ) -> msg) -> Params -> Platform.Cmd.Cmd msg
Request authors from the ghost api, see https://docs.ghost.org/api/content/#authors
Params.empty
|> ...
|> authors (Config url key "v2") GotAuthors
authorsById : String -> Config -> (Result Error (List Author) -> msg) -> Params -> Platform.Cmd.Cmd msg
Request authors from the ghost api, see https://docs.ghost.org/api/content/#authors
Params.empty
|> ...
|> authorsById id (Config url key "v2") GotAuthors
authorsBySlug : String -> Config -> (Result Error (List Author) -> msg) -> Params -> Platform.Cmd.Cmd msg
Request authors from the ghost api, see https://docs.ghost.org/api/content/#authors
Params.empty
|> ...
|> authorsBySlug id (Config url key "v2") GotAuthors
config : String -> String -> String -> Config
A clean way of initializing the basic configuration settings, that takes care of the url-ending.
errorToString : Error -> String
Pass in a Ghost.Error
and it will return a string of wheater it is
a HttpError
or a ghost related Error.
pages : Config -> (Result Error ( List Post, Meta ) -> msg) -> Params -> Platform.Cmd.Cmd msg
Request pages from the ghost api, see https://docs.ghost.org/api/content/#pages
Params.empty
|> ...
|> pages (Config url key "v2") GotPages
pagesById : String -> Config -> (Result Error (List Post) -> msg) -> Params -> Platform.Cmd.Cmd msg
Request pages from the ghost api, see https://docs.ghost.org/api/content/#pages
Params.empty
|> ...
|> pagesById id (Config url key "v2") GotPages
pagesBySlug : String -> Config -> (Result Error (List Post) -> msg) -> Params -> Platform.Cmd.Cmd msg
Request pages from the ghost api, see https://docs.ghost.org/api/content/#pages
Params.empty
|> ...
|> pagesBySlug id (Config url key "v2") GotPages
posts : Config -> (Result Error ( List Post, Meta ) -> msg) -> Params -> Platform.Cmd.Cmd msg
Request posts from the ghost api, see https://docs.ghost.org/api/content/#posts
Params.empty
|> ...
|> posts (Config url key "v2") GotPosts
postsById : String -> Config -> (Result Error (List Post) -> msg) -> Params -> Platform.Cmd.Cmd msg
Request posts from the ghost api, see https://docs.ghost.org/api/content/#posts
Params.empty
|> ...
|> postsById id (Config url key "v2") GotPosts
postsBySlug : String -> Config -> (Result Error (List Post) -> msg) -> Params -> Platform.Cmd.Cmd msg
Request posts from the ghost api, see https://docs.ghost.org/api/content/#posts
Params.empty
|> ...
|> postsBySlug id (Config url key "v2") GotPosts
settings : Config -> (Result Error Settings -> msg) -> Params -> Platform.Cmd.Cmd msg
Request tags from the ghost api, see https://docs.ghost.org/api/content/#settings
Params.empty
|> ...
|> tagsBySlug id (Config url key "v2") GotSettings
In contrast to all other requests, you will receive a single record.
tags : Config -> (Result Error ( List Tag, Meta ) -> msg) -> Params -> Platform.Cmd.Cmd msg
Request tags from the ghost api, see https://docs.ghost.org/api/content/#tags
Params.empty
|> Params.fields ...
|> ...
|> tags (Config url key "v2") GotTags
tagsById : String -> Config -> (Result Error (List Tag) -> msg) -> Params -> Platform.Cmd.Cmd msg
Request tags from the ghost api, see https://docs.ghost.org/api/content/#tags
Params.empty
|> Params.fields ...
|> ...
|> tagsById id (Config url key "v2") GotTags
tagsBySlug : String -> Config -> (Result Error (List Tag) -> msg) -> Params -> Platform.Cmd.Cmd msg
Request tags from the ghost api, see https://docs.ghost.org/api/content/#tags
Params.empty
|> Params.fields ...
|> ...
|> tagsBySlug id (Config url key "v2") GotTags