Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Rename and Tag update calls to specify a ResourceType #35

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Cloudinary/Cloudinary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,8 @@ public RenameResult Rename(string fromPublicId, string toPublicId, bool overwrit
/// <returns></returns>
public RenameResult Rename(RenameParams parameters)
{
string uri = m_api.ApiUrlImgUpV.Action("rename").BuildUrl();
string uri = m_api.ApiUrlV.ResourceType(
Api.GetCloudinaryParam<ResourceType>(parameters.ResourceType)).Action("rename").BuildUrl();

using (HttpWebResponse response =m_api.Call(HttpMethod.POST, uri, parameters.ToParamsDictionary(), null))
{
Expand Down Expand Up @@ -441,7 +442,8 @@ public TextResult Text(TextParams parameters)
/// <returns>Results of tags management</returns>
public TagResult Tag(TagParams parameters)
{
string uri = m_api.ApiUrlImgUpV.Action("tags").BuildUrl();
string uri = m_api.ApiUrlV.ResourceType(
Api.GetCloudinaryParam<ResourceType>(parameters.ResourceType)).Action("tags").BuildUrl();

using (HttpWebResponse response =m_api.Call(HttpMethod.POST, uri, parameters.ToParamsDictionary(), null))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public RenameParams(string fromPublicId, string toPublicId)
{
FromPublicId = fromPublicId;
ToPublicId = toPublicId;
ResourceType = ResourceType.Image;
}

/// <summary>
Expand Down Expand Up @@ -45,6 +46,11 @@ public RenameParams(string fromPublicId, string toPublicId)
/// </value>
public bool Invalidate { get; set; }

/// <summary>
/// The type of resource to rename
/// </summary>
public ResourceType ResourceType { get; set; }

/// <summary>
/// Maps object model to dictionary of parameters in cloudinary notation
/// </summary>
Expand Down
10 changes: 10 additions & 0 deletions Cloudinary/Shared/Coudinary.NetCoreShared/Actions/TagParams.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ namespace CloudinaryDotNet.Actions
/// </summary>
public class TagParams : BaseParams
{
public TagParams()
{
ResourceType = ResourceType.Image;
}

List<string> m_publicIds = new List<string>();

/// <summary>
Expand All @@ -36,6 +41,11 @@ public List<string> PublicIds
/// </summary>
public TagCommand Command { get; set; }

/// <summary>
/// The type of resource to change tags on
/// </summary>
public ResourceType ResourceType { get; set; }

/// <summary>
/// Validate object model
/// </summary>
Expand Down
6 changes: 4 additions & 2 deletions Cloudinary/Shared/Coudinary.NetCoreShared/Cloudinary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,8 @@ public RenameResult Rename(string fromPublicId, string toPublicId, bool overwrit
/// <returns></returns>
public RenameResult Rename(RenameParams parameters)
{
string uri = m_api.ApiUrlImgUpV.Action("rename").BuildUrl();
string uri = m_api.ApiUrlV.ResourceType(
Api.GetCloudinaryParam<ResourceType>(parameters.ResourceType)).Action("rename").BuildUrl();

using (HttpResponseMessage response =m_api.Call(CloudinaryShared.Core.HttpMethod.POST, uri, parameters.ToParamsDictionary(), null))
{
Expand Down Expand Up @@ -422,7 +423,8 @@ public TextResult Text(TextParams parameters)
/// <returns>Results of tags management</returns>
public TagResult Tag(TagParams parameters)
{
string uri = m_api.ApiUrlImgUpV.Action("tags").BuildUrl();
string uri = m_api.ApiUrlV.ResourceType(
Api.GetCloudinaryParam<ResourceType>(parameters.ResourceType)).Action("tags").BuildUrl();

using (HttpResponseMessage response =m_api.Call(CloudinaryShared.Core.HttpMethod.POST, uri, parameters.ToParamsDictionary(), null))
{
Expand Down