public void TestPostAddNewShape() { SlidesApi target = new SlidesApi(APIKEY, APPSID, BASEPATH); StorageApi storageApi = new StorageApi(APIKEY, APPSID, BASEPATH); string name = "test_slide.pptx"; int? slideIndex = 1; string folder = null; string storage = null; Shape body = new Shape(); body.Name = "Aspsoe"; body.ShapeType = "Line"; body.AlternativeText = "aspose.com"; storageApi.PutCreate(name, null, null, System.IO.File.ReadAllBytes("\\temp\\slides\\resources\\" + name)); ResponseMessage actual; actual = target.PostAddNewShape(name, slideIndex, folder, storage, body); Assert.AreEqual(200, actual.Code); Assert.IsInstanceOfType(new Com.Aspose.Slides.Model.ResponseMessage(), actual.GetType()); }
/// <summary> /// /// </summary> /// <param name="name"></param> /// <param name="slideIndex"></param> /// <param name="shapePath"></param> /// <param name="folder"></param> /// <param name="storage"></param> /// <param name="body"></param> /// <returns></returns> public ResponseMessage PutSlideShapeInfo (string name, int? slideIndex, string shapePath, string folder, string storage, Shape body) { // create path and map variables var ResourcePath = "/slides/{name}/slides/{slideIndex}/shapes/{shapePath}/?appSid={appSid}&folder={folder}&storage={storage}".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 || slideIndex == null || shapePath == 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 (slideIndex == null){ ResourcePath = Regex.Replace(ResourcePath, @"([&?])slideIndex=", ""); }else{ ResourcePath = ResourcePath.Replace("{" + "slideIndex" + "}", apiInvoker.ToPathValue(slideIndex)); } if (shapePath == null){ ResourcePath = Regex.Replace(ResourcePath, @"([&?])shapePath=", ""); }else{ ResourcePath = ResourcePath.Replace("{" + "shapePath" + "}", apiInvoker.ToPathValue(shapePath)); } if (folder == null){ ResourcePath = Regex.Replace(ResourcePath, @"([&?])folder=", ""); }else{ ResourcePath = ResourcePath.Replace("{" + "folder" + "}", apiInvoker.ToPathValue(folder)); } if (storage == null){ ResourcePath = Regex.Replace(ResourcePath, @"([&?])storage=", ""); }else{ ResourcePath = ResourcePath.Replace("{" + "storage" + "}", apiInvoker.ToPathValue(storage)); } try { if (typeof(ResponseMessage) == typeof(ResponseMessage)) { var response = apiInvoker.invokeBinaryAPI(basePath, ResourcePath, "PUT", queryParams, null, headerParams, formParams); return (ResponseMessage) ApiInvoker.deserialize(response, typeof(ResponseMessage)); } else { var response = apiInvoker.invokeAPI(basePath, ResourcePath, "PUT", 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; } } }