Skip to content

Commit

Permalink
Add V2 features. Multi photo download, download extract, download ext…
Browse files Browse the repository at this point in the history
…ract with replace bg, dual fileoutput
  • Loading branch information
kev-le committed Jan 24, 2024
1 parent 88bb465 commit f37e140
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions StudioClient.Example/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@

using System.Security.Principal;
using NetVips;
using Newtonsoft.Json.Linq;

namespace SkylabStudio.Example
{
class Program
Expand All @@ -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}";
Expand All @@ -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)
{
Expand Down

0 comments on commit f37e140

Please sign in to comment.