0.4.0 • Published 2 years ago
@glen/wiki-rpc-client v0.4.0
Client for Wiki RPC Interface 2.0
TypeScript client for Wiki RPC Interface 2.0 (web.archive.org).
This is the Remote API interface that Dokuwiki implements.
Usage
import { WikiRpcClient } from "@glen/wiki-rpc-client";
const main = async () => {
const url = "http://localhost/lib/exe/xmlrpc.php";
const client = new WikiRpcClient(url);
const data = await client.call("wiki.getPage", ["start"]);
console.log(data);
};
main().catch((e: Error) => console.error(e));
Additionally, you can create client proxy and specify function signatures
import { WikiRpcClient, WikiService, DokuwikiService, DokuwikiPluginStructService } from "@glen/wiki-rpc-client";
// create client proxy with DokuwikiService service definitions
const client = WikiRpcClient.create<DokuwikiService>(url);
// the services can be combined as well:
const client = WikiRpcClient.create<WikiService & DokuwikiService>(url);
// combine with "struct" plugin methods:
const client = WikiRpcClient.create<WikiService & DokuwikiService & DokuwikiPluginStructService>(url);
const dwVersion = await client["dokuwiki.getVersion"]();
console.log(dwVersion);
const data = await client["wiki.getPage"]("start");
console.log(data);