Initial commit
This commit is contained in:
44
ts/printer.ts
Normal file
44
ts/printer.ts
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user