public async Task <dynamic> StartWorkItem(StartWorkItemInput input, string rootPath)
        {
            string fileSavePath = await SaveTheFileOnTheServer(input.inputFile, rootPath);

            string bucketKey = NickName.ToLower().ReplyToCharToEnglishFormat() + "-designautomation7";

            var accessToken = await AccessToken();

            await CreateBucketsApi(SetAccessTokenToBuckets(accessToken), bucketKey);

            string inputFileOss = await UploadInputFileToObject(accessToken, fileSavePath, input.inputFile, bucketKey);

            string inputFileArgumentUrl = CreateArgumentUrl(bucketKey, inputFileOss);
            var    inputFileArgument    = CreateArgument(inputFileArgumentUrl, accessToken);

            dynamic inputJson      = new JObject();
            var     validationData = BasicInputValidation(input.data);

            inputJson.Width  = validationData["widthParam"];
            inputJson.Height = validationData["heigthParam"];
            string inputJsonArgumentUrl = "data:application/json, " + ((JObject)inputJson).ToString(Formatting.None).Replace("\"", "'");
            var    inputJsonArgument    = CreateArgument(inputJsonArgumentUrl);


            string outputFileNameOSS     = CreateFileNameOss(input.inputFile, "output");
            string outputFileArgumentUrl = CreateArgumentUrl(bucketKey, outputFileNameOSS);
            var    outputFileArgument    = CreateArgument(outputFileArgumentUrl, accessToken, Verb.Put);
            string browerConnectionId    = validationData["browerConnectionId"];
            string callbackUrl           = string.Format("{0}/api/forge/callback/designautomation?id={1}&outputFileName={2}", WebHookUrl, browerConnectionId, outputFileNameOSS);



            return(await GetWorkItemId(inputFileArgument, outputFileArgument, inputJsonArgument, callbackUrl, validationData["activityName"]));
        }
示例#2
0
 public async Task <dynamic> StartWorkItem(StartWorkItemInput input, string rootPath)
 {
     return(await _service.StartWorkItem(input, rootPath));
 }
示例#3
0
        public async Task <IActionResult> StartWorkitem([FromForm] StartWorkItemInput input)
        {
            dynamic result = await _workItemServiceAdapter.StartWorkItem(input, _envoironment.WebRootPath);

            return(Ok(result));
        }