https://github.com/glensc/node-wiki-rpc-client
Client for Wiki RPC Interface 2.0
https://github.com/glensc/node-wiki-rpc-client
Last synced: 2 months ago
JSON representation
Client for Wiki RPC Interface 2.0
- Host: GitHub
- URL: https://github.com/glensc/node-wiki-rpc-client
- Owner: glensc
- License: bsd-3-clause
- Created: 2023-03-30T17:27:30.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-04-28T22:00:03.000Z (about 2 years ago)
- Last Synced: 2025-02-24T10:48:31.871Z (3 months ago)
- Language: TypeScript
- Size: 38.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Client for Wiki RPC Interface 2.0
TypeScript client for [Wiki RPC Interface 2.0][1] ([web.archive.org][2]).
This is the [Remote API interface][3] that [Dokuwiki][4] implements.
[1]: http://www.jspwiki.org/wiki/WikiRPCInterface2
[2]: https://web.archive.org/web/20130526043929/http://www.jspwiki.org/wiki/WikiRPCInterface2
[3]: https://www.dokuwiki.org/xmlrpc
[4]: https://www.dokuwiki.org## Usage
```ts
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
```ts
import { WikiRpcClient, WikiService, DokuwikiService, DokuwikiPluginStructService } from "@glen/wiki-rpc-client";// create client proxy with DokuwikiService service definitions
const client = WikiRpcClient.create(url);// the services can be combined as well:
const client = WikiRpcClient.create(url);// combine with "struct" plugin methods:
const client = WikiRpcClient.create(url);const dwVersion = await client["dokuwiki.getVersion"]();
console.log(dwVersion);const data = await client["wiki.getPage"]("start");
console.log(data);
```## Authentication
For Dokuwiki you can pass username and password via options:
```ts
const options = {
basic_auth: {
user: "glen",
pass: String(process.env.WIKI_PASSWORD),
},
};
```Dokuwiki has upcoming support for JWT authentication:
- https://github.com/dokuwiki/dokuwiki/pull/2432```ts
const options = {
bearer_auth: String(process.env.WIKI_TOKEN),
};
```