public TransformResult CreateTransform(CreateTransformParams parameters) { UrlBuilder urlBuilder = new UrlBuilder( m_api.ApiUrlV. ResourceType("transformations"). Add(parameters.Name). BuildUrl()); urlBuilder.QueryString["transformation"] = parameters.Transform.Generate(); using (HttpWebResponse response = m_api.Call( HttpMethod.POST, urlBuilder.ToString(), null, null)) { TransformResult result = TransformResult.Parse(response); return result; } }
public void TestDeleteTransform() { // should allow deleting named transformation m_cloudinary.DeleteTransform("api_test_transformation2"); CreateTransformParams create = new CreateTransformParams() { Name = "api_test_transformation2", Transform = new Transformation().Crop("scale").Width(103) }; TransformResult createResult = m_cloudinary.CreateTransform(create); Assert.AreEqual("created", createResult.Message); m_cloudinary.DeleteTransform("api_test_transformation2"); GetTransformResult getResult = m_cloudinary.GetTransform( new GetTransformParams() { Transformation = "api_test_transformation2" }); Assert.AreEqual(HttpStatusCode.NotFound, getResult.StatusCode); }
public void TestCreateTransform() { // should allow creating named transformation Transformation t = new Transformation().Crop("scale").Width(102); CreateTransformParams create = new CreateTransformParams() { Name = "api_test_transformation", Transform = t }; m_cloudinary.CreateTransform(create); GetTransformParams get = new GetTransformParams() { Transformation = create.Name }; GetTransformResult getResult = m_cloudinary.GetTransform(get); Assert.IsNotNull(getResult); Assert.AreEqual(true, getResult.Strict); Assert.AreEqual(false, getResult.Used); Assert.AreEqual(1, getResult.Info.Length); Assert.AreEqual(t.Generate(), new Transformation(getResult.Info[0]).Generate()); }