The client has been developed as part of a research programme investigating agent-based manufacturing systems. It is isomorphic and able to both server (Node.js) and client-side (Browser).
To install the package, use the following code. I am aiming to put it onto npm soon.
pnpm install https://github.com/JamesGopsill/octoprint-client
You can then use in your code via by importing
import { OctoPrintClient } from "octoprint-client"
// Create a new client.
const client = new OctoPrintClient("OCTOPRINT_URL", "API_KEY")
const version = await client.version()
if (version.ok) {
console.log(version.data)
}
To test the client, we use the OctoPrint docker image and spin up a local instance that the client can interface with. To spin up an instance, you will need docker installed. Then simply go cd
into the tests directory and run:
docker-compose up
To create the Octoprint instance that can be accessed via http://localhost
. You will need configure octoprint the first time you run the container. Once configured, you can access the api key from the settings menu in OctoPrint. You will then need to create a test.config.ts
file in the tests folder (ignored by .gitignore) to add the parameters in to create the client during the tests. The file should contain the following:
export const url = "ADD URL"
export const apiKey = "ADD API KEY"
The docs have been produced using TypeDoc and can be accessed here.
We would love to have additional contributors to the project to help us maintain and add functionality to the project.
The project has been supported by the EPSRC-funded Brokering Additive Manufacturing project (EP/V05113X/1). More details on the project can be found at the Design Manufacturing Futures Lab website.
To donate and provide continued support, please go to [TODO].
Generated using TypeDoc