1import { NextRequest, NextResponse } from "next/server";
2import { fieldpineServerApi } from "@/lib/server/fieldpineApi";
3import { getStoredAuth } from "@/lib/server/auth";
6 * Printing Pending List API
8 * Get list of pending print jobs/labels
9 * Uses: retailmax.elink.printingpending.list
11export async function GET(request: NextRequest) {
13 const authData = await getStoredAuth();
15 return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
18 const { searchParams } = new URL(request.url);
19 const limit = searchParams.get("limit");
21 const params: Record<string, string> = {
22 "3": "retailmax.elink.printingpending.list"
29 console.log('[Printing Pending API] Fetching pending print jobs');
31 const result = await fieldpineServerApi.buckApiCall(params, authData.apiKey!);
33 return NextResponse.json({
38 } catch (error: any) {
39 console.error("[Printing Pending API] Error:", error);
40 return NextResponse.json(
41 { success: false, error: error.message || "Failed to fetch printing pending list" },
42 { status: error.status || 500 }