HttpKbStorage class

HTTP-backed implementation of KbStorage.

Talks to a remote knowledge-base server using a small REST convention:

  • GET /entities/{type}/{id} -> read entity
  • PUT /entities/{type}/{id} -> write entity (body = Markdown)
  • DELETE /entities/{type}/{id} -> delete entity
  • GET /entities/{type} -> JSON list of ids
  • GET /files/{path} -> read structure file
  • PUT /files/{path} -> write structure file
  • GET /context -> JSON context
  • POST /initialize?clean={true|false} -> initialize/clean backend

The exact URL layout can be changed by subclassing and overriding the _url helpers.

Implemented types
Available extensions

Constructors

HttpKbStorage(String baseUrl, {Map<String, String>? headers, Client? client})

Properties

baseUrl Uri
final
hashCode int
The hash code for this object.
no setterinherited
headers Map<String, String>
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

appendToFile(String path, String content) Future<void>

Available on KbStorage, provided by the KbStorageAppend extension

Appends content to the file at path.
deleteEntity(String type, String id) Future<void>
Deletes an entity.
override
describeLocation(String type, String id) String
Returns a human-readable location for an entity.
override
initialize({bool clean = false}) FutureOr<void>
Initializes the backend (creates directories, tables, buckets, etc.).
override
listEntityIds(String type) Future<List<String>>
Lists all entity ids of the given type.
override
listFilePaths(String prefix) Future<List<String>>
Lists logical paths of stored files that start with prefix.
override
loadContext() Future<KBContext>
Loads existing context: next IDs, people, topics, question summaries.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
readEntity(String type, String id) Future<String?>
Reads the raw Markdown content of an entity.
override
readFile(String path) Future<String?>
Reads a structure/index/graph file by its logical path.
override
toString() String
A string representation of this object.
inherited
writeEntity(String type, String id, String content) Future<void>
Writes raw Markdown content for an entity.
override
writeFile(String path, String content) Future<void>
Writes a structure/index/graph file.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited