API doc tweaks

This commit is contained in:
Neale Pickett 2020-10-16 15:39:20 -06:00
parent f430386110
commit d016555fb4
1 changed files with 28 additions and 32 deletions

View File

@ -230,6 +230,8 @@ so `curl` and `wget` can be used.
JSON object describing a puzzle. JSON object describing a puzzle.
#### JSON Puzzle Object
```js ```js
{ {
"Pre": { // Things which appear before the puzzle is solved "Pre": { // Things which appear before the puzzle is solved
@ -336,26 +338,23 @@ Puzzle executables must be named `mkpuzzle`.
## `mkpuzzle puzzle` ## `mkpuzzle puzzle`
``` puzzles/category3/1 $ ./mkpuzzle puzzle
puzzles/category3/1 $ ./mkpuzzle puzzle {JSON PUZZLE OBJECT}
{JSON PUZZLE OBJECT}
``` Also see [JSON Puzzle Object](#json-puzzle-object)
## `mkpuzzle file {filename}` ## `mkpuzzle file {filename}`
``` puzzles/category3/1 $ ./mkpuzzle file attachment.txt
puzzles/category3/1 $ ./mkpuzzle file attachment.txt This is an attachment file! It's just plain text for this example. Many attachments are JPEGs.
This is an attachment file! It's just plain text for this example. Many attachments are JPEGs.
```
## `mkpuzzle answer {answer}` ## `mkpuzzle answer {answer}`
``` puzzles/category3/1 $ ./mkpuzzle answer "cow goes moo"
puzzles/category3/1 $ ./mkpuzzle answer "cow goes moo" {"Correct":false}
{"Correct":false}
```
# Category # Category
@ -367,34 +366,28 @@ Category executables must be called `mkcategory`.
## `mkcategory inventory` ## `mkcategory inventory`
``` puzzles/category2 $ ./mkcategory inventory
puzzles/category2 $ ./mkcategory inventory {"Inventory": [1, 2, 3, 5, 10, 20, 30, 50, 100]}
{"Inventory": [1, 2, 3, 5, 10, 20, 30, 50, 100]}
```
## `mkcategory puzzle {points}` ## `mkcategory puzzle {points}`
``` puzzles/category2 $ ./mkcategory puzzle 1
puzzles/category2 $ ./mkcategory puzzle 1 {JSON PUZZLE OBJECT}
{JSON PUZZLE OBJECT}
``` Also see [JSON Puzzle Object](#json-puzzle-object)
## `mkcategory file {points} {filename}` ## `mkcategory file {points} {filename}`
``` puzzles/category2 $ ./mkcategory file 1 attachment.txt
puzzles/category2 $ ./mkcategory file 1 attachment.txt This is an attachment file's contents!
This is an attachment file's contents!
```
## `mkcategory answer {points} {answer}` ## `mkcategory answer {points} {answer}`
``` puzzles/category2 $ ./mkcategory answer 1 "cow goes moo"
puzzles/category2 $ ./mkcategory answer 1 "cow goes moo" {"Correct":false}
{"Correct":false}
```
@ -412,7 +405,7 @@ This could ostensibly be expanded to call HTTP servers,
with the four endpoints described here. with the four endpoints described here.
If somebody were to want such a thing. If somebody were to want such a thing.
## Inventory ## `provider inventory`
$ provider inventory $ provider inventory
{ {
@ -420,17 +413,20 @@ If somebody were to want such a thing.
"category2": [20, 40, 70, 150] "category2": [20, 40, 70, 150]
} }
## Puzzle ## `provider puzzle {category} {points}`
$ provider puzzle category1 20 $ provider puzzle category1 20
{JSON PUZZLE OBJECT} {JSON PUZZLE OBJECT}
## Attachment Also see [JSON Puzzle Object](#json-puzzle-object)
## `provider file {category} {points} {filename}`
$ provider file category1 20 attachment.txt $ provider file category1 20 attachment.txt
This is an attachment! Yay! This is an attachment! Yay!
## Answer ## `provider answer {category} {points} {answer}`
$ provider answer category1 20 "cow goes moo" $ provider answer category1 20 "cow goes moo"
{"Correct":true} {"Correct":true}