miaEngiadina/elm-ghost/2.0.0

Ghost

This module contains all functions to access any kind of ghost related resource, these are Config, Authors, Errors, Mata, Posts, Settingss, Tags.

See https://docs.ghost.org/api/content/#resources

type alias Author =
Author

A record for all author related information.

type alias Config =
{ 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

type Error
= GhostError (List Error)
| HttpError Error

A Ghost Error is a combined type of GhostError and HttpError.

type alias Meta =
Meta

Meta information are part of every HTTP response, except for settings and contain pagination related information:

https://docs.ghost.org/api/content/#pagination

type alias Post =
Post

A record for all post related information.

type alias Settings =
Settings

A record for all setting related information.

type alias Tag =
Tag

A record for all tag related information.

Config
-> (Result Error ( List Author, Meta ) -> msg)
-> Params
-> Cmd msg

Request authors from the ghost api, see https://docs.ghost.org/api/content/#authors

Params.empty
|> ...
|> authors (Config url key "v2") GotAuthors
String
-> Config
-> (Result Error (List Author) -> msg)
-> Params
-> 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
String
-> Config
-> (Result Error (List Author) -> msg)
-> Params
-> 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.

Config
-> (Result Error ( List Post, Meta ) -> msg)
-> Params
-> Cmd msg

Request pages from the ghost api, see https://docs.ghost.org/api/content/#pages

Params.empty
|> ...
|> pages (Config url key "v2") GotPages
String
-> Config
-> (Result Error (List Post) -> msg)
-> Params
-> 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
String
-> Config
-> (Result Error (List Post) -> msg)
-> Params
-> 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
Config
-> (Result Error ( List Post, Meta ) -> msg)
-> Params
-> Cmd msg

Request posts from the ghost api, see https://docs.ghost.org/api/content/#posts

Params.empty
|> ...
|> posts (Config url key "v2") GotPosts
String
-> Config
-> (Result Error (List Post) -> msg)
-> Params
-> 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
String
-> Config
-> (Result Error (List Post) -> msg)
-> Params
-> 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 -> 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 -> 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 -> 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 -> 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