From f37e14053682ef5816af8a3a4b5e395e1473a1ed Mon Sep 17 00:00:00 2001 From: kev-le Date: Tue, 23 Jan 2024 17:04:56 -0800 Subject: [PATCH] Add V2 features. Multi photo download, download extract, download extract with replace bg, dual fileoutput --- StudioClient.Example/Program.cs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/StudioClient.Example/Program.cs b/StudioClient.Example/Program.cs index 699dd77..fb734fd 100644 --- a/StudioClient.Example/Program.cs +++ b/StudioClient.Example/Program.cs @@ -1,4 +1,8 @@  +using System.Security.Principal; +using NetVips; +using Newtonsoft.Json.Linq; + namespace SkylabStudio.Example { class Program @@ -12,7 +16,7 @@ static async Task Main(string[] args) Guid randomUuid = Guid.NewGuid(); // CREATE PROFILE - dynamic profile = await apiClient.CreateProfile(new { name = $"Test Profile ({randomUuid})", enable_crop = false, enable_color = true }); + dynamic profile = await apiClient.CreateProfile(new { name = $"Test Profile ({randomUuid})", enable_crop = false, enable_color = false, enable_extract = true }); // CREATE JOB var jobName = $"test-job-{randomUuid}"; @@ -21,9 +25,17 @@ static async Task Main(string[] args) // UPLOAD PHOTO string filePath = "/path/to/photo"; dynamic res = await apiClient.UploadJobPhoto(filePath, job.id.Value); - + // QUEUE JOB - dynamic queuedJob = await apiClient.QueueJob(job.id.Value, new { callback_url = "YOUR_CALLBACK_ENDPOINT" }); + dynamic queuedJob = await apiClient.QueueJob(job.id.Value, new { callback_url = "http://127.0.0.1:3030" }); + + // FETCH COMPLETED JOB (wait until job status is completed) + dynamic completedJob = await apiClient.GetJob(queuedJob.id.Value); + + // DOWNLOAD COMPLETED JOB PHOTOS + JArray photosList = completedJob.photos; + await apiClient.DownloadAllPhotos(photosList, completedJob.profile, "/output/folder/"); + } catch (Exception ex) {