Interface ApiModule

All Superinterfaces:
ResourceModule

public non-sealed interface ApiModule extends ResourceModule
Modules that are defined programmatically by plugins.

API modules are only queried when a .xml document is loaded. It's presumed that an API module creates documents and links style sheets to them programmatically so the ability to load stylesheets and other external files (like item json files) is not provided.

  • Method Details

    • loadDocument

      Result<Document,String> loadDocument(@NotNull @NotNull ResourcePath path, @NotNull @NotNull DocumentContext context)
      Loads a document at the specified path.

      The path given to this method will never have an empty file path. If a user asks for a page with only a module name given, then the system will automatically add the index.xml file to that path.

      While this function is allowed to return any kind of error, the following errors are officially supported, meaning that when this method is called through ViewResources.loadDocument(String) they will not be prefixed with "Module error: %reason%".

      Supported errors
      Error message Description
      "No such file" Means the path does not point to a document file
      "Access Denied: %reason% Access to the specified resource was denied
      "IO Error: %reason%" Indicates an IO error some kind ocurred
      "Missing plugins: %plugin-list%" Indicates one or more required plugins was missing. %plugin-list% is a comma separated list of plugin names
      Parameters:
      path - Document path
      context - Document opening context
      Returns:
      Created document, or an erroneous result.