From 03e053bc388c5b6ede94857c75d0474b0b072cee Mon Sep 17 00:00:00 2001 From: Matus Backor Date: Mon, 27 May 2024 13:02:01 +0200 Subject: [PATCH] EN-199 Add options for selecting entities to copy when cloning environment --- .../CodeSamples/CmApiV2.cs | 4 ++++ .../Models/Environments/CopyDataOptions.cs | 21 +++++++++++++++++++ .../Environments/EnvironmentCloneModel.cs | 6 ++++++ 3 files changed, 31 insertions(+) create mode 100644 Kontent.Ai.Management/Models/Environments/CopyDataOptions.cs diff --git a/Kontent.Ai.Management.Tests/CodeSamples/CmApiV2.cs b/Kontent.Ai.Management.Tests/CodeSamples/CmApiV2.cs index b2422aa1..22c8d81b 100644 --- a/Kontent.Ai.Management.Tests/CodeSamples/CmApiV2.cs +++ b/Kontent.Ai.Management.Tests/CodeSamples/CmApiV2.cs @@ -1665,6 +1665,10 @@ public async void PostCloneEnvironment() RolesToActivate = new[] { Guid.Parse("2f925111-1457-49d4-a595-0958feae8ae4") + }, + CopyDataOptions = new CopyDataOptions { + ContentItemsAssets = true, + ContentItemVersionHistory = false } }); diff --git a/Kontent.Ai.Management/Models/Environments/CopyDataOptions.cs b/Kontent.Ai.Management/Models/Environments/CopyDataOptions.cs new file mode 100644 index 00000000..975f87df --- /dev/null +++ b/Kontent.Ai.Management/Models/Environments/CopyDataOptions.cs @@ -0,0 +1,21 @@ +using Newtonsoft.Json; + +namespace Kontent.Ai.Management.Models.Environments; + +/// +/// Represents options for copying entities +/// +public class CopyDataOptions +{ + /// + /// Gets or sets an option to copy content items and assets. + /// + [JsonProperty("content_items_assets")] + public bool ContentItemsAssets { get; set; } + + /// + /// Gets or sets an option to copy version history of content items. + /// + [JsonProperty("content_item_version_history")] + public bool ContentItemVersionHistory { get; set; } +} \ No newline at end of file diff --git a/Kontent.Ai.Management/Models/Environments/EnvironmentCloneModel.cs b/Kontent.Ai.Management/Models/Environments/EnvironmentCloneModel.cs index 5be76a0d..c9b23f3f 100644 --- a/Kontent.Ai.Management/Models/Environments/EnvironmentCloneModel.cs +++ b/Kontent.Ai.Management/Models/Environments/EnvironmentCloneModel.cs @@ -20,4 +20,10 @@ public class EnvironmentCloneModel /// [JsonProperty("roles_to_activate")] public ICollection RolesToActivate { get; set; } + + /// + /// Gets or sets for copying entities. + /// + [JsonProperty("copy_data_options")] + public CopyDataOptions CopyDataOptions { get; set; } }