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§

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

Structs§

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

Enums§

Credentials
Credentials to authenticate against the Wiki.js API.