diff --git a/Kontent.Ai.Management.Tests/CodeSamples/CmApiV2.cs b/Kontent.Ai.Management.Tests/CodeSamples/CmApiV2.cs index 6b12f425..e4c6d135 100644 --- a/Kontent.Ai.Management.Tests/CodeSamples/CmApiV2.cs +++ b/Kontent.Ai.Management.Tests/CodeSamples/CmApiV2.cs @@ -846,6 +846,16 @@ public async void PatchSnippet() new ContentTypeSnippetPatchRemoveModel { Path = "/elements/external_id:my-multiple-choice-id/options/codename:my_option" + }, + new ContentTypeSnippetPatchMoveModel + { + Path = "/elements/codename:my_metadata_snippet__my_meta_title", + After = Reference.ByCodename("my_metadata_snippet__my_meta_description") + }, + new ContentTypeSnippetPatchMoveModel + { + Path = "/elements/external_id:my-multiple-choice-id/options/id:8e6ec8b1-6510-4b9b-b4be-6c977f4bdfbc", + Before = Reference.ById(Guid.Parse("6bfe5a60-5cc2-4303-8f72-9cc53431046b")) } }); @@ -908,6 +918,11 @@ public async void PatchTaxonomyGroup() ExternalId = "my-new-term", Terms = Array.Empty() } + }, + new TaxonomyGroupMovePatchModel + { + Reference = Reference.ByExternalId("my-new-term"), + Before = Reference.ByCodename("first_term") } }); @@ -959,6 +974,16 @@ public async void PatchContentType() new ContentTypeRemovePatchModel { Path = "/elements/id:0b2015d0-16ae-414a-85f9-7e1a4b3a3eae" + }, + new ContentTypeMovePatchModel + { + Path = "/elements/codename:my_text_element", + After = Reference.ByExternalId("my-title-id") + }, + new ContentTypeMovePatchModel + { + Path = "/elements/external_id:my-multiple-choice-id/options/id:d66ffa49-86ff-eeaa-c33b-e5d9eefe8b81", + Before = Reference.ById(Guid.Parse("523e6231-8d80-a158-3601-dffde4e64a78")) } }); diff --git a/Kontent.Ai.Management.Tests/ManagementClientTests/ContentTypeSnippetTests.cs b/Kontent.Ai.Management.Tests/ManagementClientTests/ContentTypeSnippetTests.cs index 8e72ff96..9b307a6e 100644 --- a/Kontent.Ai.Management.Tests/ManagementClientTests/ContentTypeSnippetTests.cs +++ b/Kontent.Ai.Management.Tests/ManagementClientTests/ContentTypeSnippetTests.cs @@ -304,6 +304,10 @@ public async void ModifyContentTypeSnippetAsync_NoChanges_Throws() }, After = Reference.ByCodename("personas"), Path = "/elements" + }, + new ContentTypeSnippetPatchMoveModel { + Path = "/elements/codename:summary", + After = Reference.ByCodename("personas") } }; diff --git a/Kontent.Ai.Management.Tests/ManagementClientTests/ContentTypeTests.cs b/Kontent.Ai.Management.Tests/ManagementClientTests/ContentTypeTests.cs index a7f91c9b..70b73f6f 100644 --- a/Kontent.Ai.Management.Tests/ManagementClientTests/ContentTypeTests.cs +++ b/Kontent.Ai.Management.Tests/ManagementClientTests/ContentTypeTests.cs @@ -303,6 +303,10 @@ public async void ModifyContentTypeAsync_NoChanges_Throws() }, Before = Reference.ByCodename("theme"), Path = "/elements" + }, + new ContentTypeMovePatchModel { + Path = "/elements/codename:display_options", + After = Reference.ByCodename("theme") } }; } diff --git a/Kontent.Ai.Management.Tests/ManagementClientTests/TaxonomyGroupTests.cs b/Kontent.Ai.Management.Tests/ManagementClientTests/TaxonomyGroupTests.cs index 1e0d9d2a..c5541347 100644 --- a/Kontent.Ai.Management.Tests/ManagementClientTests/TaxonomyGroupTests.cs +++ b/Kontent.Ai.Management.Tests/ManagementClientTests/TaxonomyGroupTests.cs @@ -296,6 +296,10 @@ public async void ModifyTaxonomyGroupAsync_IdentifierIsNull_Throws() ExternalId = "b378225f-6dfc-e261-3848-dd030a6d7883", Terms = Array.Empty() } + }, + new TaxonomyGroupMovePatchModel { + Reference = Reference.ByCodename("chemex"), + Under = Reference.ByCodename("hario") } }; } diff --git a/Kontent.Ai.Management/Models/TaxonomyGroups/Patch/TaxonomyGroupMovePatchModel.cs b/Kontent.Ai.Management/Models/TaxonomyGroups/Patch/TaxonomyGroupMovePatchModel.cs new file mode 100644 index 00000000..44ff250f --- /dev/null +++ b/Kontent.Ai.Management/Models/TaxonomyGroups/Patch/TaxonomyGroupMovePatchModel.cs @@ -0,0 +1,37 @@ +using Kontent.Ai.Management.Models.Shared; +using Newtonsoft.Json; + +namespace Kontent.Ai.Management.Models.TaxonomyGroups.Patch; + +/// +/// Represents the move operation. +/// More info: https://kontent.ai/learn/reference/management-api-v2#operation/modify-a-taxonomy-group +/// +public class TaxonomyGroupMovePatchModel : TaxonomyGroupOperationBaseModel +{ + /// + /// Represents the move operation. + /// + public override string Op => "move"; + + /// + /// Gets or sets reference of the existing taxonomy term before which you want to move the specified taxonomy term. + /// Note: The before, after and under properties are mutually exclusive. + /// + [JsonProperty("before")] + public Reference Before { get; set; } + + /// + /// Gets or sets reference of the existing taxonomy term after which you want to move the specified taxonomy term. + /// Note: The before, after and under properties are mutually exclusive. + /// + [JsonProperty("after")] + public Reference After { get; set; } + + /// + /// Gets or sets reference of the existing taxonomy term under which you want to move the specified taxonomy term. + /// Note: The before, after and under properties are mutually exclusive. + /// + [JsonProperty("under")] + public Reference Under { get; set; } +} \ No newline at end of file diff --git a/Kontent.Ai.Management/Models/TypeSnippets/Patch/ContentTypeSnippetPatchMoveModel.cs b/Kontent.Ai.Management/Models/TypeSnippets/Patch/ContentTypeSnippetPatchMoveModel.cs new file mode 100644 index 00000000..60580d23 --- /dev/null +++ b/Kontent.Ai.Management/Models/TypeSnippets/Patch/ContentTypeSnippetPatchMoveModel.cs @@ -0,0 +1,30 @@ +using Kontent.Ai.Management.Models.Shared; +using Newtonsoft.Json; + +namespace Kontent.Ai.Management.Models.TypeSnippets.Patch; + +/// +/// Represents the move operation. +/// More info: https://kontent.ai/learn/reference/management-api-v2#operation/modify-a-content-type-snippet +/// +public class ContentTypeSnippetPatchMoveModel : ContentTypeSnippetOperationBaseModel +{ + /// + /// Represents the move operation. + /// + public override string Op => "move"; + + /// + /// Gets or sets reference of the existing object before which you want to move the specified object. + /// Note: The before and after properties are mutually exclusive. + /// + [JsonProperty("before")] + public Reference Before { get; set; } + + /// + /// Gets or sets reference of the existing object after which you want to move the specified object. + /// Note: The before and after properties are mutually exclusive. + /// + [JsonProperty("after")] + public Reference After { get; set; } +} \ No newline at end of file diff --git a/Kontent.Ai.Management/Models/Types/Patch/ContentTypeMovePatchModel.cs b/Kontent.Ai.Management/Models/Types/Patch/ContentTypeMovePatchModel.cs new file mode 100644 index 00000000..2fac343f --- /dev/null +++ b/Kontent.Ai.Management/Models/Types/Patch/ContentTypeMovePatchModel.cs @@ -0,0 +1,30 @@ +using Kontent.Ai.Management.Models.Shared; +using Newtonsoft.Json; + +namespace Kontent.Ai.Management.Models.Types.Patch; + +/// +/// Represents the move operation. +/// More info: https://kontent.ai/learn/reference/management-api-v2#operation/modify-a-content-type +/// +public class ContentTypeMovePatchModel : ContentTypeOperationBaseModel +{ + /// + /// Represents the move operation. + /// + public override string Op => "move"; + + /// + /// Gets or sets reference of the existing object before which you want to move the specified object. + /// Note: The before and after properties are mutually exclusive. + /// + [JsonProperty("before")] + public Reference Before { get; set; } + + /// + /// Gets or sets reference of the existing object after which you want to move the specified object. + /// Note: The before and after properties are mutually exclusive. + /// + [JsonProperty("after")] + public Reference After { get; set; } +} \ No newline at end of file