Files
BambuddyCameraBridge/ts/printer.ts
2026-06-30 17:06:06 +02:00

45 lines
1001 B
TypeScript

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;
}