/// <summary> /// Uploads a file to cloudinary. /// </summary> /// <param name="parameters">Parameters of file uploading.</param> /// <param name="type">The type ("raw" or "auto", last by default).</param> public RawUploadResult Upload(RawUploadParams parameters, string type = "auto") { string uri = m_api.ApiUrlImgUpV.ResourceType(type).BuildUrl(); ResetInternalFileDescription(parameters.File); using (HttpWebResponse response = m_api.Call(HttpMethod.POST, uri, parameters.ToParamsDictionary(), parameters.File)) { return RawUploadResult.Parse(response); } }
public void TestDestroyRaw() { RawUploadParams uploadParams = new RawUploadParams() { File = new FileDescription(m_testImagePath) }; RawUploadResult uploadResult = m_cloudinary.Upload(uploadParams, "raw"); Assert.NotNull(uploadResult); DeletionParams destroyParams = new DeletionParams(uploadResult.PublicId) { ResourceType = ResourceType.Raw }; DeletionResult destroyResult = m_cloudinary.Destroy(destroyParams); Assert.AreEqual("ok", destroyResult.Result); }
/// <summary> /// Upload a raw file to cloudinary /// </summary> /// <param name="parameters">Parameters of uploading a file to cloudinary</param> /// <returns>Results of file uploading</returns> public RawUploadResult Upload(RawUploadParams parameters) { string uri = m_api.ApiUrlImgUpV.ResourceType("raw").BuildUrl(); using (HttpWebResponse response = m_api.Call(HttpMethod.POST, uri, parameters.ToParamsDictionary(), parameters.File)) { return RawUploadResult.Parse(response); } }
public void TestModeration() { var uploadParams = new RawUploadParams() { File = new FileDescription(m_testImagePath), Moderation = "manual" }; var uploadResult = m_cloudinary.Upload(uploadParams); Assert.NotNull(uploadResult); Assert.NotNull(uploadResult.Moderation); Assert.AreEqual(1, uploadResult.Moderation.Count); Assert.AreEqual("manual", uploadResult.Moderation[0].Kind); Assert.AreEqual(ModerationStatus.Pending, uploadResult.Moderation[0].Status); var getResult = m_cloudinary.GetResource(uploadResult.PublicId); Assert.NotNull(getResult); Assert.NotNull(getResult.Moderation); Assert.AreEqual(1, getResult.Moderation.Count); Assert.AreEqual("manual", getResult.Moderation[0].Kind); Assert.AreEqual(ModerationStatus.Pending, getResult.Moderation[0].Status); }