hexagram30 / language

A syntagmata and Markov chain language, word, and name generator for use in hexagram30 narratives
3 stars 1 forks source link

Create a REST API for the language app #22

Open oubiwann opened 6 years ago

oubiwann commented 6 years ago

Depends on #23

oubiwann commented 6 years ago

Possible routes:

;; for the following, support query parameters for providing your own language frequencies data 
;; structure ... for all, support word, sentence, and paragraph parameters
/api/language/gen/assembled 
/api/language/gen/assembled/:world ; if lang is not provided, return results for all
/api/language/gen/assembled/:world/:lang
;; for the following, support query parameters word, sentence, and paragraph
;; if language is not provided, return results for all
/api/language/gen ; return both markov and syntagmata
/api/language/gen/markov
/api/language/gen/syntagmata
/api/language/gen/:lang
/api/language/gen/:lang/markov
/api/language/gen/:lang/syntagmata
;; if race/name are not provided, return results for all
/api/language/gen/name 
/api/language/gen/name/markov
/api/language/gen/name/syntagmata
;; if name-type is not provided, return results for all
/api/language/gen/name/:race
/api/language/gen/name/:race/markov
/api/language/gen/name/:race/syntagmata
/api/language/gen/name/:race/:name-type 
/api/language/gen/name/:race/:name-type/markov
/api/language/gen/name/:race/:name-type/syntagmata
;; stats downloads as JSON data
/api/language/stats/:lang/markov
/api/language/stats/:lang/syntagmata
/api/language/stats/:race/:name-type/markov
/api/language/stats/:race/:name-type/syntagmata
;; for the following, use HTTP verbs for updates, additions, deletes, etc. 
/api/language/dictionary/:lang
;; dedicated search resource
/api/language/dictionary/:lang/search

In all cases, if word, sentence, or paragraph parameters are not provided, then word will be assumed.

All resources should provide a /help companion resource that should return the docstring for the associated operation's docstring (probably the handler). Formats supported should be .md (default), .txt, and .html

Note that the inclusion of language in the routes is necessary, since this will ultimately be pulled into a deployment that offers the combined REST APIs from multiple hexagram30 projects, each with their own /api/something.