diff --git a/src/config/routes.ts b/src/config/routes.ts index 87e7d32..5aebadb 100644 --- a/src/config/routes.ts +++ b/src/config/routes.ts @@ -94,4 +94,8 @@ export const SHARE_KEY_PATH = BASE_API_ENDPOINT + "/share-key"; // Import Shared export const IMPORT_SHARED_PATH = BASE_API_ENDPOINT + "/import-shared"; -export const IMPORT_SHARED_UPLOAD_ALL_PATH = BASE_API_ENDPOINT + "/import-shared/upload-all"; \ No newline at end of file +export const IMPORT_SHARED_UPLOAD_ALL_PATH = BASE_API_ENDPOINT + "/import-shared/upload-all"; + +// Import Jobs (queue) +export const IMPORT_JOBS_PATH = BASE_API_ENDPOINT + "/import-jobs"; +export const IMPORT_JOB_PATH = (jobId: string) => BASE_API_ENDPOINT + "/import-jobs/" + jobId; \ No newline at end of file diff --git a/src/handlers/api/import-jobs.handler.ts b/src/handlers/api/import-jobs.handler.ts new file mode 100644 index 0000000..bff95d9 --- /dev/null +++ b/src/handlers/api/import-jobs.handler.ts @@ -0,0 +1,18 @@ +import { IMPORT_JOBS_PATH, IMPORT_JOB_PATH } from "@/config/routes"; +import API from "@/lib/api"; + +export interface CreateImportJobParams { + platform: string; + url: string; + urlConfig: Record; + importData: Record; + assets: { id: string; [key: string]: unknown }[]; +} + +export const createImportJob = async (params: CreateImportJobParams): Promise<{ jobId: string }> => { + return API.post(IMPORT_JOBS_PATH, params); +}; + +export const getImportJob = async (jobId: string) => { + return API.get(IMPORT_JOB_PATH(jobId)); +};