Crate wikijs

source ·
Expand description

API bindings, CLI client and FUSE filesystem for Wiki.js written in Rust.

This documents the library only, for more information on using the CLI and FUSE refer to their -h/--help commands.

§Structure

The central struct is Api which is used to directly access all functionality of the Wiki.js APIs. This very flat structure should allow you easy discovery and autocompletion.

The library has submodules for each of the Wiki.js’ API endpoints. They contain the internal implementation of the library functions as well as all the structs and enums used to interact with the API.

§Example

The following example shows you to login via an API key and retrieve a page::Page struct:

use wikijs::{Api, Credentials};

let api = Api::new(
    "http://localhost:3000".to_string(),
    Credentials::Key("my-api-key".to_string()),
).unwrap();
// this returns a page::Page
let page = api.page_get(1).unwrap();
println!("{:?}", page);

§Error handling

All API functions return a Result with custom module specific error types derived from Wiki.js’ error codes. Note we are ignoring a potential page::PageError in the example above!

§Testing

The integration tests require a clean Wiki.js instance running on localhost with predefined admin login credentials. See the testing section of the README on Github or your clone of the project for more details.

Modules§

  • Structs, enums, errors and internal API call implementations to interact with the analytics settings.
  • Structs, enums, errors and internal API call implementations to interact with the assets and asset folders.
  • Structs, enums, errors and internal API call implementations to call authentication functions, create API keys and so on.
  • Structs, enums, errors and internal API call implementations to interact with comments.
  • Common functions and traits used by multiple modules.
  • Structs, enums, errors and internal API call implementations to list contributors.
  • Structs, enums, errors and internal API call implementations to interact with user groups.
  • Structs, enums, errors and internal API call implementations to interact with localization settings.
  • Structs, enums, errors and internal API call implementations to interact with logging settings.
  • Structs, enums, errors and internal API call implementations to interact with mail settings.
  • Structs, enums, errors and internal API call implementations to interact with navigation settings and modify the navigation tree.
  • Structs, enums, errors and internal API call implementations to interact with pages and their directory structure.
  • Structs, enums, errors and internal API call implementations to interact with rendering settings.
  • Structs, enums, errors and internal API call implementations to interact with search engine settings.
  • Structs, enums, errors and internal API call implementations to interact with site settings.
  • Structs, enums, errors and internal API call implementations to interact with storage settings.
  • Structs, enums, errors and internal API call implementations to interact with system settings.
  • Structs, enums, errors and internal API call implementations to interact with theming settings.
  • Structs, enums, errors and internal API call implementations to interact with users.

Structs§

  • Central struct to access all Wiki.js API endpoints.

Enums§

  • Credentials to authenticate against the Wiki.js API.