Initial commit

This commit is contained in:
2026-06-30 17:06:06 +02:00
commit d0bb893522
19 changed files with 1333 additions and 0 deletions

44
ts/printer.ts Normal file
View File

@@ -0,0 +1,44 @@
import { BambuddyAddress } from './constants';
export async function getPrinterDetails(
bearerToken: string,
printerId: number,
): Promise<PrinterDetails | null> {
const request = await fetch(
`${BambuddyAddress}/api/v1/printers/${printerId}`,
{
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${bearerToken}`,
},
method: 'GET',
},
);
const response = await request.json();
return response as PrinterDetails;
}
export interface PrinterDetails {
name: string;
serial_number: string;
ip_address: string;
access_code: string;
model: string;
location: string;
auto_archive: boolean;
external_camera_url: string;
external_camera_type: string;
external_camera_enabled: boolean;
external_camera_snapshot_url: string | null;
camera_rotation: number;
id: number;
is_active: boolean;
nozzle_count: number;
print_hours_offset: number;
plate_detection_enabled: boolean;
plate_detection_roi: any;
created_at: string;
updated_at: string;
}