mirror of
https://github.com/matrix-org/homerunner-client.git
synced 2026-11-17 03:40:32 +00:00
A JS library for interfacing with Complement's homerunner application.
- TypeScript 99%
- JavaScript 1%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| src | ||
| tests | ||
| .eslintrc | ||
| .gitignore | ||
| .npmignore | ||
| jest.config.js | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
| tsconfig.lint.json | ||
| yarn.lock | ||
homerunner-client
A JS library for interfacing with Complement's homerunner application.
See matrix-org/complement for details on how that works.
The library is environment variable aware, and will use the following URLs in order when communicating with homerunner:
- The URL provided to
Homerunner.Clientin the constructor. HOMERUNNER_URL, if provided as an environment variable.http://localhost:{process.env.HOMERUNNER_PORT}, ifHOMERUNNER_PORTis provided as an environment variable.http://localhost:54321
Usage
You can install the package with npm install homerunner-client or yarn add homerunner-client.
Example
Below is a simple example of how to use the library. Consult the type definitions for more advanced usage.
const client = new Homerunner.Client();
const blueprint1 = await client.create("my-blueprint");
// or
const blueprint2 = await client.create({
base_image_uri: "complement-dendrite",
blueprint: {
Name: "my-custom-blueprint",
Homeservers: [{
Name: "hs1",
Users: [{
Localpart: "alice",
DisplayName: "Alice",
}]
}]
}
});
// or
const blueprint3 = await client.create({
base_image_uri: "complement-dendrite",
blueprint_name: "federation_one_to_one_room"
})
// Do some testing....
await client.destroy("my-blueprint");
await client.destroy("my-custom-blueprint");
await client.destroy("federation_one_to_one_room");