Skip to content

Commit

Permalink
fix documentation for http routes
Browse files Browse the repository at this point in the history
  • Loading branch information
inmysocks committed Dec 13, 2020
1 parent af0897b commit 68d2416
Show file tree
Hide file tree
Showing 16 changed files with 79 additions and 66 deletions.
1 change: 0 additions & 1 deletion AutomaticBackups.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ exports.startup = function () {
if($tw.node) {
$tw.ServerSide = $tw.ServerSide || require('$:/plugins/OokTech/Bob/ServerSide.js');
// Make sure that $tw.settings is available.
//const settings = require('$:/plugins/OokTech/NodeSettings/NodeSettings.js')
// require the fs module if we are running node
const fs = require("fs");
const path = require("path");
Expand Down
24 changes: 0 additions & 24 deletions Documentation/HTTPAPI/get-fetch-tiddlers.tid

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
title: $:/plugins/OokTech/Bob/Documentation/HTTPAPI/get-list-files
tags: [[HTTP API]]
verb: GET
route: /api/list/files /api/list/files/path/:prefix /api/list/files/wiki/:wikiname
response: JSON object with a list of globally available files
route: /api/files/list /api/files/list/path/:prefix /api/files/list/wiki/:wikiname
response: JSON object with a list of available files
parameters:
description: get a list of available files on the server

Using the `/api/list/files/` path the list of files returned is from the folder
Using the `/api/files/list/` path the list of files returned is from the folder
listed as the `filePathRoot`.

Using the `/api/list/files/path/:prefix` path returns the list of files served
Using the `/api/files/list/path/:prefix` path returns the list of files served
using the prefix `:prefix`.

Using the `/api/list/files/wiki/:wikiname` path returns the files specific to
Using the `/api/files/list/wiki/:wikiname` path returns the files specific to
the wiki `:wikiname`. These files are in the `files` folder next to the
`tiddlers` folder for the wiki.

Expand All @@ -32,6 +32,6 @@ appended to the front of the file name, like `/files/file1.png`.

Example:

* `/api/list/files`
* `/api/list/files/path/foo`
* `/api/list/files/wiki/someWiki`
* `/api/files/list`
* `/api/files/list/path/foo`
* `/api/files/list/wiki/someWiki`
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
title: $:/plugins/OokTech/Bob/Documentation/HTTPAPI/fetch-plugin
tags: [[HTTP API]]
verb: GET
route: /api/fetch/plugins/:plugin
route: /api/plugins/fetch/:plugin
response: The plugin tiddler as JSON
parameters:
description: fetch a plugin from the server
Expand All @@ -14,4 +14,4 @@ The `:plugin` part of the path should be in the from `Author/PluginName`.

Example:

* `/api/fetch/plugins/OokTech/Bob`
* `/api/plugins/fetch/OokTech/Bob`
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
title: $:/plugins/OokTech/Bob/Documentation/HTTPAPI/get-list-plugins
title: $:/plugins/OokTech/Bob/Documentation/HTTPAPI/get-plugins-list
tags: [[HTTP API]]
verb: GET
route: /api/list/plugins
route: /api/plugins/list
response: An array of JSON objects that contain information about the available plugins
parameters:
description: get a list of available plugins
Expand Down Expand Up @@ -32,4 +32,4 @@ The retuned object is in the form:

Example:

* `/api/list/plugins`
* `/api/plugins/list`
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
title: $:/plugins/OokTech/Bob/Documentation/HTTPAPI/get-fetch-tiddler-html
tags: [[HTTP API]]
verb: GET
route: /api/fetch/tiddler/html
route: /api/tiddlers/fetch/html/:wiki
response: The rendered html of the requested tiddler
parameters: `wiki` `tiddler`
parameters: `tiddler`
description: get the rendered html of a tiddler

Note: Because of how Bob handles different wikis, this doesn't render the
static css in the expected way.

Get the rendered html version of a tiddler.

Example:

* `/api/fetch/tiddler/html?wiki=SomeWiki&tiddler=tiddlerTitle`
* `/api/tiddlers/fetch/html/SomeWiki?tiddler=tiddlerTitle`
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
title: $:/plugins/OokTech/Bob/Documentation/HTTPAPI/fetch-list
tags: [[HTTP API]]
verb: GET
route: /api/fetch/list
route: /api/tiddlers/fetch/list/:wikiname
response: A JSON object containing a list of tiddler titles and optionally additional fields from the tiddlers
parameters: `wiki` `filter` `fields`
parameters: `filter` `fields`
description: fetch a list of tiddler titles from a wiki using a filter

Requests a list of tiddler titles selected using a filter evaluated in a named
wiki.

The url parameters are:

* `wiki` is the name of the wiki to fetch titles from, it must be url encoded if it has spaces or `/` characters
* `filter` is the filter to run in the target wiki
* `fields` is a comma separated list of fields that are returned in the `info` part of the returned object. Defaults to `modified`
* `fields` is an optional space separated list of fields to include in the info section of the returned data

The returned JSON object has the form:

Expand All @@ -35,5 +34,5 @@ The returned JSON object has the form:

Examples:

* `/api/fetch/list?wiki=SomeWiki&filter=[tag[foo]]`
* `/api/fetch/list?wiki=SomeOtherWiki&filter=[tag[bar]]`
* `/api/fetch/list/SomeWiki?filter=[tag[foo]]`
* `/api/fetch/list/SomeOtherWiki?filter=[tag[bar]]&fields=modified tags`
36 changes: 36 additions & 0 deletions Documentation/HTTPAPI/get-tiddlers-fetch.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
title: $:/plugins/OokTech/Bob/Documentation/HTTPAPI/get-fetch-tiddlers
tags: [[HTTP API]]
verb: GET
route: /api/tiddlers/fetch/:wikiname
response: Tiddlers in JSON format
parameters: `filter` `tiddler`
description: fetch tiddlers from the server

Return a set of tiddlers using a filter, from the named wiki.


Parameters:

* `filter` the filter to evaluate in the wiki to select tiddlers to fetch
* `fields` a space separated list of field names that get included in the `info` part of the returned data

the returned json object has the form:

```
{
list: ["title1", "title2"],
tiddlers: {
title1: {\* tiddler fields *\},
title2: {\* tiddler fields *\}
},
info: {
title1: {\* fields listed in the fields paramater *\},
title2: {\* fields listed in the fields paramater *\}
}
}
```

Examples:

* `/api/fetch?wiki=someWiki&filter=[tag[foo]]`
* `/api/fetch?wiki=someWiki&filter=[tag[foo]]&fields=foo bar`
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
title: $:/plugins/OokTech/Bob/Documentation/HTTPAPI/get-list-wikis
tags: [[HTTP API]]
verb: GET
route: /api/list/wikis
route: /api/wikis/list
response: A JSON object containing a list of available wikis
parameters:
description: get a list of available wikis
Expand Down
14 changes: 0 additions & 14 deletions Documentation/HTTPAPI/post-rename-wiki.tid

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
title: $:/plugins/OokTech/Bob/Documentation/HTTPAPI/delete-tiddler
tags: [[HTTP API]]
verb: POST
route: /api/delete/tiddler/:wikiname
route: /api/tiddlers/delete/:wikiname
description: Delete one or more tiddlers from a wiki

This is POST instead of DELETE because in general nothing but the url should
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
title: $:/plugins/OokTech/Bob/Documentation/HTTPAPI/post-push
tags: [[HTTP API]]
verb: POST
route: /api/push/:wikiname
route: /api/tiddlers/push/:wikiname
response:
parameters:
description: push tiddlers to a wiki
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
title: $:/plugins/OokTech/Bob/Documentation/HTTPAPI/delete-wiki
tags: [[HTTP API]]
verb: POST
route: /api/delete/wiki/:wikiname
route: /api/wiki/delete/:wikiname
description: Delete a wiki

This deletes the wiki `:wikiname` given in the URL.
Expand Down
14 changes: 14 additions & 0 deletions Documentation/HTTPAPI/post-wiki-rename.tid
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
title: $:/plugins/OokTech/Bob/Documentation/HTTPAPI/post-wiki-rename
tags: [[HTTP API]]
verb: POST
route: /api/wiki/rename/:wikiname
response:
parameters: newname
description: rename a wiki

This renames a wiki.

`:wikiname` in the url is the wiki to rename, the `newname` parameter is the
new name.

Anything in the POST body will be ignored.
2 changes: 1 addition & 1 deletion ServerRoutes/ServerRoutes/get-tiddlers-fetch-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ get /^\/api\/tiddlers\/fetch\/list\/<<wikiName>>\/?$/
fetch a list of tiddlers returned by a filter
params: ?wiki=wikiName&filter=<<someFilter>>&fields=tags
params: ?filter=<<someFilter>>
\*/
(function() {
Expand Down

0 comments on commit 68d2416

Please sign in to comment.