public void TestPostSlidesSaveAsHtml() { SlidesApi target = new SlidesApi(APIKEY, APPSID, BASEPATH); StorageApi storageApi = new StorageApi(APIKEY, APPSID, BASEPATH); string name = "test_slide.pptx"; string password = null; string storage = null; string folder = null; string outPath = null; HtmlExportOptions body = new HtmlExportOptions(); body.SaveAsZip = true; storageApi.PutCreate(name, null, null, System.IO.File.ReadAllBytes("\\temp\\slides\\resources\\" + name)); ResponseMessage actual; actual = target.PostSlidesSaveAsHtml(name, password, storage, folder, outPath, body); Assert.AreEqual(200, actual.Code); Assert.IsInstanceOfType(new Com.Aspose.Slides.Model.ResponseMessage(), actual.GetType()); }
/// <summary> /// /// </summary> /// <param name="name"></param> /// <param name="password"></param> /// <param name="storage"></param> /// <param name="folder"></param> /// <param name="outPath"></param> /// <param name="body"></param> /// <returns></returns> public ResponseMessage PostSlidesSaveAsHtml (string name, string password, string storage, string folder, string outPath, HtmlExportOptions body) { // create path and map variables var ResourcePath = "/slides/{name}/saveAs/html/?appSid={appSid}&password={password}&storage={storage}&folder={folder}&outPath={outPath}".Replace("{format}","json"); ResourcePath = Regex.Replace(ResourcePath, "\\*", "").Replace("&", "&").Replace("/?", "?").Replace("toFormat={toFormat}", "format={format}"); // query params var queryParams = new Dictionary<String, String>(); var headerParams = new Dictionary<String, String>(); var formParams = new Dictionary<String, object>(); // verify required params are set if (name == null || body == null ) { throw new ApiException(400, "missing required params"); } if (name == null){ ResourcePath = Regex.Replace(ResourcePath, @"([&?])name=", ""); }else{ ResourcePath = ResourcePath.Replace("{" + "name" + "}", apiInvoker.ToPathValue(name)); } if (password == null){ ResourcePath = Regex.Replace(ResourcePath, @"([&?])password="******""); }else{ ResourcePath = ResourcePath.Replace("{" + "password" + "}", apiInvoker.ToPathValue(password)); } if (storage == null){ ResourcePath = Regex.Replace(ResourcePath, @"([&?])storage=", ""); }else{ ResourcePath = ResourcePath.Replace("{" + "storage" + "}", apiInvoker.ToPathValue(storage)); } if (folder == null){ ResourcePath = Regex.Replace(ResourcePath, @"([&?])folder=", ""); }else{ ResourcePath = ResourcePath.Replace("{" + "folder" + "}", apiInvoker.ToPathValue(folder)); } if (outPath == null){ ResourcePath = Regex.Replace(ResourcePath, @"([&?])outPath=", ""); }else{ ResourcePath = ResourcePath.Replace("{" + "outPath" + "}", apiInvoker.ToPathValue(outPath)); } try { if (typeof(ResponseMessage) == typeof(ResponseMessage)) { var response = apiInvoker.invokeBinaryAPI(basePath, ResourcePath, "POST", queryParams, null, headerParams, formParams); return (ResponseMessage) ApiInvoker.deserialize(response, typeof(ResponseMessage)); } else { var response = apiInvoker.invokeAPI(basePath, ResourcePath, "POST", queryParams, body, headerParams, formParams); if(response != null){ return (ResponseMessage) ApiInvoker.deserialize(response, typeof(ResponseMessage)); } else { return null; } } } catch (ApiException ex) { if(ex.ErrorCode == 404) { return null; } else { throw ex; } } }