Skip to content

Commit 5721153

Browse files
Add support for delivery Type setter in URL
1 parent 4d12ea8 commit 5721153

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

CloudinaryDotNet.IntegrationTests/UploadApi/UploadMethodsTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ public void TestUploadAnsiAndUnicode()
518518

519519
var expectedUrl = uploadresponse.SecureUrl.OriginalString;
520520

521-
var computedUrl = m_cloudinary.Api.UrlImgUp.Action("authenticated").Version(uploadresponse.Version).Secure(true).Signed(true).BuildUrl(publicId + ".jpg");
521+
var computedUrl = m_cloudinary.Api.UrlImgUp.Type("authenticated").Version(uploadresponse.Version).Secure(true).Signed(true).BuildUrl(publicId + ".jpg");
522522

523523
Assert.AreEqual(expectedUrl, computedUrl);
524524

CloudinaryDotNet.Tests/Transformations/Image/SpriteTest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ public void TestSprite()
2929
{
3030
// should build urls to get sprite css and picture by tag (with transformations and prefix)
3131

32-
var uri = m_api.UrlImgUp.Action("sprite").BuildUrl("teslistresourcesbytag1.png");
32+
var uri = m_api.UrlImgUp.Type("sprite").BuildUrl("teslistresourcesbytag1.png");
3333
Assert.AreEqual(TestConstants.DefaultRootPath + "image/sprite/teslistresourcesbytag1.png", uri);
3434

35-
uri = m_api.UrlImgUp.Action("sprite").BuildUrl("teslistresourcesbytag1.css");
35+
uri = m_api.UrlImgUp.Type("sprite").BuildUrl("teslistresourcesbytag1.css");
3636
Assert.AreEqual(TestConstants.DefaultRootPath + "image/sprite/teslistresourcesbytag1.css", uri);
3737

3838
uri = m_api.ApiUrlImgUpV.CloudinaryAddr("http://api.cloudinary.com").Action("sprite").BuildUrl();
@@ -44,7 +44,7 @@ public void TestSpriteCssPrefix()
4444
{
4545
// should build urls to get sprite css and picture by tag with prefix
4646

47-
string uri = m_api.UrlImgUp.Action("sprite").Add("p_home_thing_").BuildUrl("logo.css");
47+
string uri = m_api.UrlImgUp.Type("sprite").Add("p_home_thing_").BuildUrl("logo.css");
4848
Assert.AreEqual(TestConstants.DefaultRootPath + "image/sprite/p_home_thing_/logo.css", uri);
4949
}
5050

CloudinaryDotNet/Url.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,16 +314,26 @@ public Url VideoSources(params VideoSource[] videoSources)
314314
}
315315

316316
/// <summary>
317-
/// Add action to the URL.
317+
/// Set action of the URL.
318318
/// </summary>
319319
/// <param name="action">The action.</param>
320-
/// <returns>The delivery URL with action applied.</returns>
320+
/// <returns>The delivery/API URL with action applied.</returns>
321321
public Url Action(string action)
322322
{
323323
m_action = action;
324324
return this;
325325
}
326326

327+
/// <summary>
328+
/// Set delivery type of the asset URL.
329+
/// </summary>
330+
/// <param name="deliveryType">The delivery type of the asset.</param>
331+
/// <returns>The delivery URL with delivery type applied.</returns>
332+
public Url Type(string deliveryType)
333+
{
334+
return Action(deliveryType);
335+
}
336+
327337
/// <summary>
328338
/// Set the version of the cloudinary API.
329339
/// </summary>

0 commit comments

Comments
 (0)