Add background print dispatching + tests

This commit is contained in:
Ryan Ewen
2026-02-20 08:51:13 +01:00
committed by maziggy
parent 732ff634fa
commit 4a625c1ef2
19 changed files with 2112 additions and 304 deletions
+23 -2
View File
@@ -1630,6 +1630,15 @@ export interface NotificationTestResponse {
message: string;
}
export interface BackgroundDispatchResponse {
status: 'dispatched' | string;
printer_id: number;
archive_id?: number | null;
filename: string;
dispatch_job_id: number;
dispatch_position: number;
}
// Provider-specific config types for reference
export interface CallMeBotConfig {
phone: string;
@@ -2937,6 +2946,7 @@ export const api = {
printerId: number,
options?: {
plate_id?: number;
plate_name?: string;
ams_mapping?: number[];
timelapse?: boolean;
bed_levelling?: boolean;
@@ -2946,7 +2956,7 @@ export const api = {
use_ams?: boolean;
}
) =>
request<{ status: string; printer_id: number; archive_id: number; filename: string }>(
request<BackgroundDispatchResponse>(
`/archives/${archiveId}/reprint?printer_id=${printerId}`,
{
method: 'POST',
@@ -4008,6 +4018,7 @@ export const api = {
printerId: number,
options?: {
plate_id?: number;
plate_name?: string;
ams_mapping?: number[];
bed_levelling?: boolean;
flow_cali?: boolean;
@@ -4017,13 +4028,23 @@ export const api = {
use_ams?: boolean;
}
) =>
request<{ status: string; printer_id: number; archive_id: number; filename: string }>(
request<BackgroundDispatchResponse>(
`/library/files/${fileId}/print?printer_id=${printerId}`,
{
method: 'POST',
body: options ? JSON.stringify(options) : undefined,
}
),
cancelBackgroundDispatchJob: (jobId: number) =>
request<{
status: 'cancelled' | 'cancelling';
job_id: number;
source_name: string;
printer_id: number;
printer_name: string;
}>(`/background-dispatch/${jobId}`, {
method: 'DELETE',
}),
getLibraryFilePlates: (fileId: number) =>
request<LibraryFilePlatesResponse>(`/library/files/${fileId}/plates`),
getLibraryFileFilamentRequirements: (fileId: number, plateId?: number) =>