The machine's own API, reached through its tunnel as an authenticated caller.
API
@Interface("@prismshadow/penguin-server#MachineApi")
export abstract class MachineApi {
abstract request(
method: "GET" | "POST" | "PUT" | "PATCH",
path: string,
body?: unknown,
): Promise<MachineAnswer>;
abstract postBytes(
path: string,
contentType: string,
body: Buffer,
timeoutMs: number,
/** Request headers beyond the ones every call carries. */
headers?: Record<string, string>,
): Promise<MachineAnswer>;
}Members (2)
request
request(method: "GET" | "POST" | "PUT" | "PATCH", path: string, body?: unknown): Promise<MachineAnswer>@parammethod
"GET" | "POST" | "PUT" | "PATCH"@parampath
string@parambody?
unknown@returns
Promise<MachineAnswer>postBytes
postBytes(path: string, contentType: string, body: Buffer, timeoutMs: number, headers?: Record<string, string>): Promise<MachineAnswer>A POST whose body is bytes rather than JSON, with a deadline of its own. The hot update is megabytes, and the machine unpacks, boots and commits it before answering — a timeout sized for a settings write would call a working upgrade dead halfway through.
@parampath
string@paramcontentType
string@parambody
Buffer@paramtimeoutMs
number@paramheaders?
Record<string, string>@returns
Promise<MachineAnswer>