using Autodesk.Forge.Model; using Autodesk.Forge; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using System.Collections.Generic; using System.IO; using System.Threading.Tasks; namespace FrontendWebApi.ApiControllers { public class ModelDerivativeController : ControllerBase //MyBaseApiController//Controller { /// /// Start the translation job for a give bucketKey/objectName /// /// /// [HttpPost] [Route("api/forge/modelderivative/jobs")] public async Task TranslateObject([FromBody] TranslateObjectModel objModel) { dynamic oauth = await OAuthController.GetInternalAsync(); // prepare the payload List outputs = new List() { new JobPayloadItem( JobPayloadItem.TypeEnum.Svf, new List() { JobPayloadItem.ViewsEnum._2d, JobPayloadItem.ViewsEnum._3d }) }; JobPayload job; job = new JobPayload(new JobPayloadInput(objModel.objectName), new JobPayloadOutput(outputs)); // start the translation DerivativesApi derivative = new DerivativesApi(); derivative.Configuration.AccessToken = oauth.access_token; dynamic jobPosted = await derivative.TranslateAsync(job); return jobPosted; } /// /// Model for TranslateObject method /// public class TranslateObjectModel { public string bucketKey { get; set; } public string objectName { get; set; } } } }