From ac62e4f436870bf32551169be5466b999361c59f Mon Sep 17 00:00:00 2001 From: jirik2 Date: Fri, 24 Sep 2021 10:19:41 +0200 Subject: [PATCH] Rename ContentItemVariant to LanguageVariant --- .../EndpointUrlBuilderTests.cs | 12 +- .../LanguageVariantTests.cs | 118 ++++++++--------- .../WorkflowStepTests.cs | 60 ++++----- .../ModelBuildersTests/ModelProviderTests.cs | 6 +- .../ActionInvoker/ActionInvokerTests.cs | 4 +- Kentico.Kontent.Management.Tests/TestUtils.cs | 8 +- .../ManagementClient.cs | 124 +++++++++--------- .../ManagementClientExtensions.cs | 8 +- ...tifier.cs => LanguageVariantIdentifier.cs} | 10 +- ...ariantModel.cs => LanguageVariantModel.cs} | 8 +- ...Model.cs => LanguageVariantUpsertModel.cs} | 10 +- ...ariantModel.cs => LanguageVariantModel.cs} | 6 +- .../Modules/ModelBuilders/IModelProvider.cs | 4 +- .../Modules/ModelBuilders/ModelProvider.cs | 8 +- .../Modules/UrlBuilder/EndpointUrlBuilder.cs | 12 +- 15 files changed, 199 insertions(+), 199 deletions(-) rename Kentico.Kontent.Management/Models/LanguageVariants/{ContentItemVariantIdentifier.cs => LanguageVariantIdentifier.cs} (69%) rename Kentico.Kontent.Management/Models/LanguageVariants/{ContentItemVariantModel.cs => LanguageVariantModel.cs} (82%) rename Kentico.Kontent.Management/Models/LanguageVariants/{ContentItemVariantUpsertModel.cs => LanguageVariantUpsertModel.cs} (62%) rename Kentico.Kontent.Management/Models/StronglyTyped/{ContentItemVariantModel.cs => LanguageVariantModel.cs} (81%) diff --git a/Kentico.Kontent.Management.Tests/EndpointUrlBuilderTests.cs b/Kentico.Kontent.Management.Tests/EndpointUrlBuilderTests.cs index 138a6c953..da7b7b410 100644 --- a/Kentico.Kontent.Management.Tests/EndpointUrlBuilderTests.cs +++ b/Kentico.Kontent.Management.Tests/EndpointUrlBuilderTests.cs @@ -66,7 +66,7 @@ public void BuildContentItemVariantsUrl_ItemIdVariantId_ReturnsCorrectUrl() { var itemIdentifier = Reference.ById(ITEM_ID); var variantIdentifier = Reference.ById(VARIANT_ID); - var identifier = new ContentItemVariantIdentifier(itemIdentifier, variantIdentifier); + var identifier = new LanguageVariantIdentifier(itemIdentifier, variantIdentifier); var actualUrl = _builder.BuildVariantsUrl(identifier); var expectedUrl = $"{ENDPOINT}/projects/{PROJECT_ID}/items/{ITEM_ID}/variants/{VARIANT_ID}"; @@ -78,7 +78,7 @@ public void BuildContentItemVariantsUrl_ItemIdVariantCodename_ReturnsCorrectUrl( { var itemIdentifier = Reference.ById(ITEM_ID); var variantIdentifier = Reference.ByCodename(VARIANT_CODENAME); - var identifier = new ContentItemVariantIdentifier(itemIdentifier, variantIdentifier); + var identifier = new LanguageVariantIdentifier(itemIdentifier, variantIdentifier); var actualUrl = _builder.BuildVariantsUrl(identifier); var expectedUrl = $"{ENDPOINT}/projects/{PROJECT_ID}/items/{ITEM_ID}/variants/codename/{VARIANT_CODENAME}"; @@ -90,7 +90,7 @@ public void BuildContentItemVariantsUrl_ItemCodenameVariantId_ReturnsCorrectUrl( { var itemIdentifier = Reference.ByCodename(ITEM_CODENAME); var variantIdentifier = Reference.ById(VARIANT_ID); - var identifier = new ContentItemVariantIdentifier(itemIdentifier, variantIdentifier); + var identifier = new LanguageVariantIdentifier(itemIdentifier, variantIdentifier); var actualUrl = _builder.BuildVariantsUrl(identifier); var expectedUrl = $"{ENDPOINT}/projects/{PROJECT_ID}/items/codename/{ITEM_CODENAME}/variants/{VARIANT_ID}"; @@ -102,7 +102,7 @@ public void BuildContentItemVariantsUrl_ItemCodenameVariantCodename_ReturnsCorre { var itemIdentifier = Reference.ByCodename(ITEM_CODENAME); var variantIdentifier = Reference.ByCodename(VARIANT_CODENAME); - var identifier = new ContentItemVariantIdentifier(itemIdentifier, variantIdentifier); + var identifier = new LanguageVariantIdentifier(itemIdentifier, variantIdentifier); var actualUrl = _builder.BuildVariantsUrl(identifier); var expectedUrl = $"{ENDPOINT}/projects/{PROJECT_ID}/items/codename/{ITEM_CODENAME}/variants/codename/{VARIANT_CODENAME}"; @@ -114,7 +114,7 @@ public void BuildContentItemVariantsUrl_ItemExternalIdVariantId_ReturnsCorrectUr { var itemIdentifier = Reference.ByExternalId(ITEM_EXTERNAL_ID); var variantIdentifier = Reference.ById(VARIANT_ID); - var identifier = new ContentItemVariantIdentifier(itemIdentifier, variantIdentifier); + var identifier = new LanguageVariantIdentifier(itemIdentifier, variantIdentifier); var actualUrl = _builder.BuildVariantsUrl(identifier); var expectedUrl = $"{ENDPOINT}/projects/{PROJECT_ID}/items/external-id/{EXPECTED_ITEM_EXTERNAL_ID}/variants/{VARIANT_ID}"; @@ -126,7 +126,7 @@ public void BuildContentItemVariantsUrl_ItemExternalIdVariantCodename_ReturnsCor { var itemIdentifier = Reference.ByExternalId(ITEM_EXTERNAL_ID); var variantIdentifier = Reference.ByCodename(VARIANT_CODENAME); - var identifier = new ContentItemVariantIdentifier(itemIdentifier, variantIdentifier); + var identifier = new LanguageVariantIdentifier(itemIdentifier, variantIdentifier); var actualUrl = _builder.BuildVariantsUrl(identifier); var expectedUrl = $"{ENDPOINT}/projects/{PROJECT_ID}/items/external-id/{EXPECTED_ITEM_EXTERNAL_ID}/variants/codename/{VARIANT_CODENAME}"; diff --git a/Kentico.Kontent.Management.Tests/ManagementClientTests/LanguageVariantTests.cs b/Kentico.Kontent.Management.Tests/ManagementClientTests/LanguageVariantTests.cs index 0a64c8105..81d22ac8a 100644 --- a/Kentico.Kontent.Management.Tests/ManagementClientTests/LanguageVariantTests.cs +++ b/Kentico.Kontent.Management.Tests/ManagementClientTests/LanguageVariantTests.cs @@ -37,13 +37,13 @@ public LanguageVariantTests(ITestOutputHelper output) [Fact] public async Task UpsertVariant_ById_LanguageId_UpdatesVariant() { - var contentItemVariantUpsertModel = new ContentItemVariantUpsertModel() { Elements = Elements }; + var contentItemVariantUpsertModel = new LanguageVariantUpsertModel() { Elements = Elements }; var itemIdentifier = Reference.ById(EXISTING_ITEM_ID); var languageIdentifier = Reference.ById(EXISTING_LANGUAGE_ID); - var identifier = new ContentItemVariantIdentifier(itemIdentifier, languageIdentifier); + var identifier = new LanguageVariantIdentifier(itemIdentifier, languageIdentifier); - var responseVariant = await _client.UpsertContentItemVariantAsync(identifier, contentItemVariantUpsertModel); + var responseVariant = await _client.UpsertLanguageVariantAsync(identifier, contentItemVariantUpsertModel); Assert.Equal(EXISTING_ITEM_ID, responseVariant.Item.Id); Assert.Equal(EXISTING_LANGUAGE_ID, responseVariant.Language.Id); @@ -53,13 +53,13 @@ public async Task UpsertVariant_ById_LanguageId_UpdatesVariant() [Fact] public async Task UpsertVariant_ByCodename_LanguageId_UpdatesVariant() { - var contentItemVariantUpsertModel = new ContentItemVariantUpsertModel() { Elements = Elements }; + var contentItemVariantUpsertModel = new LanguageVariantUpsertModel() { Elements = Elements }; var itemIdentifier = Reference.ByCodename(EXISTING_ITEM_CODENAME); var languageIdentifier = Reference.ById(EXISTING_LANGUAGE_ID); - var identifier = new ContentItemVariantIdentifier(itemIdentifier, languageIdentifier); + var identifier = new LanguageVariantIdentifier(itemIdentifier, languageIdentifier); - var responseVariant = await _client.UpsertContentItemVariantAsync(identifier, contentItemVariantUpsertModel); + var responseVariant = await _client.UpsertLanguageVariantAsync(identifier, contentItemVariantUpsertModel); Assert.Equal(EXISTING_ITEM_ID, responseVariant.Item.Id); Assert.Equal(EXISTING_LANGUAGE_ID, responseVariant.Language.Id); @@ -69,13 +69,13 @@ public async Task UpsertVariant_ByCodename_LanguageId_UpdatesVariant() [Fact] public async Task UpsertVariant_ById_LanguageCodename_UpdatesVariant() { - var contentItemVariantUpsertModel = new ContentItemVariantUpsertModel() { Elements = Elements }; + var contentItemVariantUpsertModel = new LanguageVariantUpsertModel() { Elements = Elements }; var itemIdentifier = Reference.ById(EXISTING_ITEM_ID); var languageIdentifier = Reference.ByCodename(EXISTING_LANGUAGE_CODENAME); - var identifier = new ContentItemVariantIdentifier(itemIdentifier, languageIdentifier); + var identifier = new LanguageVariantIdentifier(itemIdentifier, languageIdentifier); - var responseVariant = await _client.UpsertContentItemVariantAsync(identifier, contentItemVariantUpsertModel); + var responseVariant = await _client.UpsertLanguageVariantAsync(identifier, contentItemVariantUpsertModel); Assert.Equal(EXISTING_ITEM_ID, responseVariant.Item.Id); Assert.Equal(EXISTING_LANGUAGE_ID, responseVariant.Language.Id); @@ -85,13 +85,13 @@ public async Task UpsertVariant_ById_LanguageCodename_UpdatesVariant() [Fact] public async Task UpsertVariant_ByCodename_LanguageCodename_UpdatesVariant() { - var contentItemVariantUpsertModel = new ContentItemVariantUpsertModel() { Elements = Elements }; + var contentItemVariantUpsertModel = new LanguageVariantUpsertModel() { Elements = Elements }; var itemIdentifier = Reference.ByCodename(EXISTING_ITEM_CODENAME); var languageIdentifier = Reference.ByCodename(EXISTING_LANGUAGE_CODENAME); - var identifier = new ContentItemVariantIdentifier(itemIdentifier, languageIdentifier); + var identifier = new LanguageVariantIdentifier(itemIdentifier, languageIdentifier); - var responseVariant = await _client.UpsertContentItemVariantAsync(identifier, contentItemVariantUpsertModel); + var responseVariant = await _client.UpsertLanguageVariantAsync(identifier, contentItemVariantUpsertModel); Assert.Equal(EXISTING_ITEM_ID, responseVariant.Item.Id); Assert.Equal(EXISTING_LANGUAGE_ID, responseVariant.Language.Id); @@ -110,9 +110,9 @@ public async Task UpsertVariant_ByExternalId_LanguageCodename_UpdatesVariant() var itemIdentifier = Reference.ByExternalId(externalId); var languageIdentifier = Reference.ByCodename(EXISTING_LANGUAGE_CODENAME); - var identifier = new ContentItemVariantIdentifier(itemIdentifier, languageIdentifier); - var contentItemVariantUpsertModel = new ContentItemVariantUpsertModel() { Elements = Elements }; - var responseVariant = await _client.UpsertContentItemVariantAsync(identifier, contentItemVariantUpsertModel); + var identifier = new LanguageVariantIdentifier(itemIdentifier, languageIdentifier); + var contentItemVariantUpsertModel = new LanguageVariantUpsertModel() { Elements = Elements }; + var responseVariant = await _client.UpsertLanguageVariantAsync(identifier, contentItemVariantUpsertModel); Assert.Equal(responseVariant.Language.Id, EXISTING_LANGUAGE_ID); AssertResponseElements(responseVariant); @@ -133,9 +133,9 @@ public async Task UpsertVariant_ByExternalId_LanguageCodename_CreatesVariant() var itemIdentifier = Reference.ByExternalId(externalId); var languageIdentifier = Reference.ByCodename(EXISTING_LANGUAGE_CODENAME); - var identifier = new ContentItemVariantIdentifier(itemIdentifier, languageIdentifier); - var contentItemVariantUpsertModel = new ContentItemVariantUpsertModel() { Elements = Elements }; - var responseVariant = await _client.UpsertContentItemVariantAsync(identifier, contentItemVariantUpsertModel); + var identifier = new LanguageVariantIdentifier(itemIdentifier, languageIdentifier); + var contentItemVariantUpsertModel = new LanguageVariantUpsertModel() { Elements = Elements }; + var responseVariant = await _client.UpsertLanguageVariantAsync(identifier, contentItemVariantUpsertModel); Assert.Equal(EXISTING_LANGUAGE_ID, responseVariant.Language.Id); AssertResponseElements(responseVariant); @@ -154,13 +154,13 @@ public async Task UpsertVariant_ByExternalId_LanguageId_UpdatesVariant() await TestUtils.PrepareTestVariant(_client, EXISTING_LANGUAGE_CODENAME, Elements, preparedItem); // Test - var contentItemVariantUpsertModel = new ContentItemVariantUpsertModel() { Elements = Elements }; + var contentItemVariantUpsertModel = new LanguageVariantUpsertModel() { Elements = Elements }; var itemIdentifier = Reference.ByExternalId(externalId); var languageIdentifier = Reference.ById(EXISTING_LANGUAGE_ID); - var identifier = new ContentItemVariantIdentifier(itemIdentifier, languageIdentifier); + var identifier = new LanguageVariantIdentifier(itemIdentifier, languageIdentifier); - var responseVariant = await _client.UpsertContentItemVariantAsync(identifier, contentItemVariantUpsertModel); + var responseVariant = await _client.UpsertLanguageVariantAsync(identifier, contentItemVariantUpsertModel); Assert.Equal(EXISTING_LANGUAGE_ID, responseVariant.Language.Id); AssertResponseElements(responseVariant); @@ -178,13 +178,13 @@ public async Task UpsertVariant_ByExternalId_LanguageId_CreatesVariant() await TestUtils.PrepareTestItem(_client, EXISTING_CONTENT_TYPE_CODENAME, externalId); // Test - var contentItemVariantUpsertModel = new ContentItemVariantUpsertModel() { Elements = Elements }; + var contentItemVariantUpsertModel = new LanguageVariantUpsertModel() { Elements = Elements }; var itemIdentifier = Reference.ByExternalId(externalId); var languageIdentifier = Reference.ById(EXISTING_LANGUAGE_ID); - var identifier = new ContentItemVariantIdentifier(itemIdentifier, languageIdentifier); + var identifier = new LanguageVariantIdentifier(itemIdentifier, languageIdentifier); - var responseVariant = await _client.UpsertContentItemVariantAsync(identifier, contentItemVariantUpsertModel); + var responseVariant = await _client.UpsertLanguageVariantAsync(identifier, contentItemVariantUpsertModel); Assert.Equal(EXISTING_LANGUAGE_ID, responseVariant.Language.Id); AssertResponseElements(responseVariant); @@ -207,7 +207,7 @@ public async Task UpsertVariant_UsingResponseModel_UpdatesVariant() preparedVariant.Elements = Elements; var itemIdentifier = Reference.ByExternalId(externalId); var languageIdentifier = Reference.ById(EXISTING_LANGUAGE_ID); - var identifier = new ContentItemVariantIdentifier(itemIdentifier, languageIdentifier); + var identifier = new LanguageVariantIdentifier(itemIdentifier, languageIdentifier); var responseVariant = await _client.UpsertContentItemVariantAsync(identifier, contentItemVariant: preparedVariant); @@ -232,7 +232,7 @@ public async Task UpsertVariant_UsingResponseModel_CreatesVariant() preparedVariant.Elements = Elements; var itemIdentifier = Reference.ByExternalId(externalId); var languageIdentifier = Reference.ById(Guid.Empty); - var identifier = new ContentItemVariantIdentifier(itemIdentifier, languageIdentifier); + var identifier = new LanguageVariantIdentifier(itemIdentifier, languageIdentifier); var responseVariant = await _client.UpsertContentItemVariantAsync(identifier, contentItemVariant: preparedVariant); @@ -249,7 +249,7 @@ public async Task ListContentItemVariants_ById_ListsVariants() { var identifier = Reference.ById(EXISTING_ITEM_ID); - var responseVariants = await _client.ListContentItemVariantsAsync(identifier); + var responseVariants = await _client.ListLanguageVariantsAsync(identifier); Assert.Equal(EXISTING_ITEM_ID, responseVariants.First().Item.Id); } @@ -259,7 +259,7 @@ public async Task ListContentItemVariants_ByCodename_ListsVariants() { var identifier = Reference.ByCodename(EXISTING_ITEM_CODENAME); - var responseVariants = await _client.ListContentItemVariantsAsync(identifier); + var responseVariants = await _client.ListLanguageVariantsAsync(identifier); Assert.Equal(EXISTING_ITEM_ID, responseVariants.First().Item.Id); } @@ -274,7 +274,7 @@ public async Task ListContentItemVariants_ByExternalId_ListsVariants() // Test var identifier = Reference.ByExternalId(externalId); - var responseVariants = await _client.ListContentItemVariantsAsync(identifier); + var responseVariants = await _client.ListLanguageVariantsAsync(identifier); Assert.Single(responseVariants); @@ -288,9 +288,9 @@ public async Task GetContentItemVariant_ById_LanguageId_GetsVariant() { var itemIdentifier = Reference.ById(EXISTING_ITEM_ID); var languageIdentifier = Reference.ById(EXISTING_LANGUAGE_ID); - var identifier = new ContentItemVariantIdentifier(itemIdentifier, languageIdentifier); + var identifier = new LanguageVariantIdentifier(itemIdentifier, languageIdentifier); - var response = await _client.GetContentItemVariantAsync(identifier); + var response = await _client.GetLanguageVariantAsync(identifier); Assert.NotNull(response); Assert.Equal(EXISTING_ITEM_ID, response.Item.Id); @@ -302,9 +302,9 @@ public async Task GetContentItemVariant_ById_LanguageCodename_GetsVariant() { var itemIdentifier = Reference.ById(EXISTING_ITEM_ID); var languageIdentifier = Reference.ByCodename(EXISTING_LANGUAGE_CODENAME); - var identifier = new ContentItemVariantIdentifier(itemIdentifier, languageIdentifier); + var identifier = new LanguageVariantIdentifier(itemIdentifier, languageIdentifier); - var response = await _client.GetContentItemVariantAsync(identifier); + var response = await _client.GetLanguageVariantAsync(identifier); Assert.NotNull(response); Assert.Equal(EXISTING_ITEM_ID, response.Item.Id); @@ -316,9 +316,9 @@ public async Task GetContentItemVariant_ByCodename_LanguageId_GetsVariant() { var itemIdentifier = Reference.ByCodename(EXISTING_ITEM_CODENAME); var languageIdentifier = Reference.ById(EXISTING_LANGUAGE_ID); - var identifier = new ContentItemVariantIdentifier(itemIdentifier, languageIdentifier); + var identifier = new LanguageVariantIdentifier(itemIdentifier, languageIdentifier); - var response = await _client.GetContentItemVariantAsync(identifier); + var response = await _client.GetLanguageVariantAsync(identifier); Assert.NotNull(response); Assert.Equal(EXISTING_ITEM_ID, response.Item.Id); @@ -330,9 +330,9 @@ public async Task GetContentItemVariant_ByCodename_LanguageCodename_GetsVariant( { var itemIdentifier = Reference.ByCodename(EXISTING_ITEM_CODENAME); var languageIdentifier = Reference.ByCodename(EXISTING_LANGUAGE_CODENAME); - var identifier = new ContentItemVariantIdentifier(itemIdentifier, languageIdentifier); + var identifier = new LanguageVariantIdentifier(itemIdentifier, languageIdentifier); - var response = await _client.GetContentItemVariantAsync(identifier); + var response = await _client.GetLanguageVariantAsync(identifier); Assert.NotNull(response); Assert.Equal(EXISTING_ITEM_ID, response.Item.Id); @@ -350,9 +350,9 @@ public async Task GetContentItemVariant_ByExternalId_LanguageCodename_GetsVarian // Test var itemIdentifier = Reference.ByExternalId(externalId); var languageIdentifier = Reference.ByCodename(EXISTING_LANGUAGE_CODENAME); - var identifier = new ContentItemVariantIdentifier(itemIdentifier, languageIdentifier); + var identifier = new LanguageVariantIdentifier(itemIdentifier, languageIdentifier); - var response = await _client.GetContentItemVariantAsync(identifier); + var response = await _client.GetLanguageVariantAsync(identifier); Assert.NotNull(response); Assert.Equal(preparedItem.Id, response.Item.Id); @@ -372,9 +372,9 @@ public async Task GetContentItemVariant_ByExternalId_ReturnsVariant() var itemIdentifier = Reference.ByExternalId(externalId); var languageIdentifier = Reference.ById(EXISTING_LANGUAGE_ID); - var identifier = new ContentItemVariantIdentifier(itemIdentifier, languageIdentifier); + var identifier = new LanguageVariantIdentifier(itemIdentifier, languageIdentifier); - var response = await _client.GetContentItemVariantAsync(identifier); + var response = await _client.GetLanguageVariantAsync(identifier); Assert.NotNull(response); Assert.Equal(preparedItem.Id, response.Item.Id); @@ -393,9 +393,9 @@ public async Task DeleteContentItemVariant_ById_LanguageCodename_DeletesVariant( var itemIdentifier = Reference.ById(itemResponse.Id); var languageIdentifier = Reference.ByCodename(EXISTING_LANGUAGE_CODENAME); - var identifier = new ContentItemVariantIdentifier(itemIdentifier, languageIdentifier); + var identifier = new LanguageVariantIdentifier(itemIdentifier, languageIdentifier); - await _client.DeleteContentItemVariantAsync(identifier); + await _client.DeleteLanguageVariantAsync(identifier); } [Fact] @@ -406,9 +406,9 @@ public async Task DeleteContentItemVariant_ById_LanguageId_DeletesVariant() var itemIdentifier = Reference.ById(itemResponse.Id); var languageIdentifier = Reference.ById(EXISTING_LANGUAGE_ID); - var identifier = new ContentItemVariantIdentifier(itemIdentifier, languageIdentifier); + var identifier = new LanguageVariantIdentifier(itemIdentifier, languageIdentifier); - await _client.DeleteContentItemVariantAsync(identifier); + await _client.DeleteLanguageVariantAsync(identifier); } [Fact] @@ -420,9 +420,9 @@ public async Task DeleteContentItemVariant_ByCodename_LanguageId_DeletesVariant( var itemIdentifier = Reference.ByCodename(itemResponse.Codename); var languageIdentifier = Reference.ById(EXISTING_LANGUAGE_ID); - var identifier = new ContentItemVariantIdentifier(itemIdentifier, languageIdentifier); + var identifier = new LanguageVariantIdentifier(itemIdentifier, languageIdentifier); - await _client.DeleteContentItemVariantAsync(identifier); + await _client.DeleteLanguageVariantAsync(identifier); } [Fact] @@ -434,9 +434,9 @@ public async Task DeleteContentItemVariant_ByCodename_LanguageCodename_DeletesVa var itemIdentifier = Reference.ByCodename(itemResponse.Codename); var languageIdentifier = Reference.ByCodename(EXISTING_LANGUAGE_CODENAME); - var identifier = new ContentItemVariantIdentifier(itemIdentifier, languageIdentifier); + var identifier = new LanguageVariantIdentifier(itemIdentifier, languageIdentifier); - await _client.DeleteContentItemVariantAsync(identifier); + await _client.DeleteLanguageVariantAsync(identifier); } [Fact] @@ -448,9 +448,9 @@ public async Task DeleteContentItemVariant_ByExternalId_LanguageId_DeletesVarian var itemIdentifier = Reference.ByExternalId(externalId); var languageIdentifier = Reference.ById(EXISTING_LANGUAGE_ID); - var identifier = new ContentItemVariantIdentifier(itemIdentifier, languageIdentifier); + var identifier = new LanguageVariantIdentifier(itemIdentifier, languageIdentifier); - await _client.DeleteContentItemVariantAsync(identifier); + await _client.DeleteLanguageVariantAsync(identifier); } [Fact] @@ -462,9 +462,9 @@ public async Task DeleteContentItemVariant_ByExternalId_LanguageCodename_Deletes var itemIdentifier = Reference.ByExternalId(externalId); var languageIdentifier = Reference.ByCodename(EXISTING_LANGUAGE_CODENAME); - var identifier = new ContentItemVariantIdentifier(itemIdentifier, languageIdentifier); + var identifier = new LanguageVariantIdentifier(itemIdentifier, languageIdentifier); - await _client.DeleteContentItemVariantAsync(identifier); + await _client.DeleteLanguageVariantAsync(identifier); } [Fact] @@ -472,7 +472,7 @@ public async Task ListStronglyTypedContentItemVariants_ById_ListsVariants() { var identifier = Reference.ById(EXISTING_ITEM_ID); - var responseVariants = await _client.ListContentItemVariantsAsync(identifier); + var responseVariants = await _client.ListLanguageVariantsAsync(identifier); Assert.All(responseVariants, x => { @@ -486,9 +486,9 @@ public async Task GetStronglyTypedContentItemVariantAsync_ById_LanguageId_GetVar { var itemIdentifier = Reference.ById(EXISTING_ITEM_ID); var languageIdentifier = Reference.ById(EXISTING_LANGUAGE_ID); - var identifier = new ContentItemVariantIdentifier(itemIdentifier, languageIdentifier); + var identifier = new LanguageVariantIdentifier(itemIdentifier, languageIdentifier); - var response = await _client.GetContentItemVariantAsync(identifier); + var response = await _client.GetLangaugeVariantAsync(identifier); Assert.NotNull(response); Assert.Equal(EXISTING_ITEM_ID, response.Item.Id); @@ -502,9 +502,9 @@ public async Task UpsertStronglyTypedContentItemVariantAsync_ById_LanguageId_Upd { var itemIdentifier = Reference.ById(EXISTING_ITEM_ID); var languageIdentifier = Reference.ById(EXISTING_LANGUAGE_ID); - var identifier = new ContentItemVariantIdentifier(itemIdentifier, languageIdentifier); + var identifier = new LanguageVariantIdentifier(itemIdentifier, languageIdentifier); - var responseVariant = await _client.UpsertContentItemVariantAsync(identifier, StronglyTypedElements); + var responseVariant = await _client.UpsertLanguageVariantAsync(identifier, StronglyTypedElements); Assert.Equal(EXISTING_ITEM_ID, responseVariant.Item.Id); Assert.Equal(EXISTING_LANGUAGE_ID, responseVariant.Language.Id); @@ -525,7 +525,7 @@ private static string UnifyWhitespace(string text) return Regex.Replace(text, "\\s+", string.Empty); } - private void AssertResponseElements(ContentItemVariantModel responseVariant) + private void AssertResponseElements(LanguageVariantModel responseVariant) { var (expected, actual) = GetElementByCodename("title", responseVariant.Elements); Assert.Equal(expected.value, actual.value); diff --git a/Kentico.Kontent.Management.Tests/ManagementClientTests/WorkflowStepTests.cs b/Kentico.Kontent.Management.Tests/ManagementClientTests/WorkflowStepTests.cs index b8fb3afc0..cdab0bbd8 100644 --- a/Kentico.Kontent.Management.Tests/ManagementClientTests/WorkflowStepTests.cs +++ b/Kentico.Kontent.Management.Tests/ManagementClientTests/WorkflowStepTests.cs @@ -48,13 +48,13 @@ public async void ChangeWorkflowStepOfVariant_ChangesWorkflowStepOfVariant() // Test var itemIdentifier = Reference.ByExternalId(externalId); var languageIdentifier = Reference.ByCodename(EXISTING_LANGUAGE_CODENAME); - var variantIdentifier = new ContentItemVariantIdentifier(itemIdentifier, languageIdentifier); + var variantIdentifier = new LanguageVariantIdentifier(itemIdentifier, languageIdentifier); var identifier = new WorkflowIdentifier(itemIdentifier, languageIdentifier, Reference.ByCodename("test")); await _client.ChangeWorkflowStep(identifier); - var updatedVariant = await _client.GetContentItemVariantAsync(variantIdentifier); + var updatedVariant = await _client.GetLanguageVariantAsync(variantIdentifier); _ = await _client.ListWorkflowStepsAsync(); Assert.Equal(CUSTOM_WORKFLOW_STEP_ID, updatedVariant.WorkflowStep.Id); @@ -75,11 +75,11 @@ public async void PublishVariant_PublishesVariant() // Test var itemIdentifier = Reference.ByExternalId(externalId); var languageIdentifier = Reference.ByCodename(EXISTING_LANGUAGE_CODENAME); - var variantIdentifier = new ContentItemVariantIdentifier(itemIdentifier, languageIdentifier); + var variantIdentifier = new LanguageVariantIdentifier(itemIdentifier, languageIdentifier); - await _client.PublishContentItemVariant(variantIdentifier); + await _client.PublishLanguageVariant(variantIdentifier); - var updatedVariant = await _client.GetContentItemVariantAsync(variantIdentifier); + var updatedVariant = await _client.GetLanguageVariantAsync(variantIdentifier); Assert.Equal(PUBLISHED_WORKFLOW_STEP_ID, updatedVariant.WorkflowStep.Id); @@ -99,13 +99,13 @@ public async void UnpublishVariant_UnpublishesVariant() // Test var itemIdentifier = Reference.ByExternalId(externalId); var languageIdentifier = Reference.ByCodename(EXISTING_LANGUAGE_CODENAME); - var variantIdentifier = new ContentItemVariantIdentifier(itemIdentifier, languageIdentifier); + var variantIdentifier = new LanguageVariantIdentifier(itemIdentifier, languageIdentifier); - await _client.PublishContentItemVariant(variantIdentifier); + await _client.PublishLanguageVariant(variantIdentifier); - await _client.UnpublishContentItemVariant(variantIdentifier); + await _client.UnpublishLangaugeVariant(variantIdentifier); - var updatedVariant = await _client.GetContentItemVariantAsync(variantIdentifier); + var updatedVariant = await _client.GetLanguageVariantAsync(variantIdentifier); Assert.Equal(ARCHIVED_WORKFLOW_STEP_ID, updatedVariant.WorkflowStep.Id); @@ -125,12 +125,12 @@ public async void CreateNewVersionsOfVariant_CreatesNewVersionsOfVariant() // Test var itemIdentifier = Reference.ByExternalId(externalId); var languageIdentifier = Reference.ByCodename(EXISTING_LANGUAGE_CODENAME); - var variantIdentifier = new ContentItemVariantIdentifier(itemIdentifier, languageIdentifier); + var variantIdentifier = new LanguageVariantIdentifier(itemIdentifier, languageIdentifier); - await _client.PublishContentItemVariant(variantIdentifier); - await _client.CreateNewVersionOfContentItemVariant(variantIdentifier); + await _client.PublishLanguageVariant(variantIdentifier); + await _client.CreateNewVersionOfLanguageVariant(variantIdentifier); - var updatedVariant = await _client.GetContentItemVariantAsync(variantIdentifier); + var updatedVariant = await _client.GetLanguageVariantAsync(variantIdentifier); Assert.Equal(DRAFT_WORKFLOW_STEP_ID, updatedVariant.WorkflowStep.Id); @@ -150,11 +150,11 @@ public async void SchedulePublishingOfVariant_SchedulesPublishingOfVariant() // Test var itemIdentifier = Reference.ByExternalId(externalId); var languageIdentifier = Reference.ByCodename(EXISTING_LANGUAGE_CODENAME); - var variantIdentifier = new ContentItemVariantIdentifier(itemIdentifier, languageIdentifier); + var variantIdentifier = new LanguageVariantIdentifier(itemIdentifier, languageIdentifier); - await _client.SchedulePublishingOfContentItemVariant(variantIdentifier, new ScheduleModel { ScheduleTo = new DateTimeOffset(2050, 1, 1, 10, 10, 0, TimeSpan.FromHours(2)) }); + await _client.SchedulePublishingOfLangaugeVariant(variantIdentifier, new ScheduleModel { ScheduleTo = new DateTimeOffset(2050, 1, 1, 10, 10, 0, TimeSpan.FromHours(2)) }); - var updatedVariant = await _client.GetContentItemVariantAsync(variantIdentifier); + var updatedVariant = await _client.GetLanguageVariantAsync(variantIdentifier); Assert.Equal(SCHEDULED_WORKFLOW_STEP_ID, updatedVariant.WorkflowStep.Id); @@ -174,18 +174,18 @@ public async void ScheduleUnpublishingOfVariant_SchedulesUnpublishingOfVariant() // Test var itemIdentifier = Reference.ByExternalId(externalId); var languageIdentifier = Reference.ByCodename(EXISTING_LANGUAGE_CODENAME); - var variantIdentifier = new ContentItemVariantIdentifier(itemIdentifier, languageIdentifier); + var variantIdentifier = new LanguageVariantIdentifier(itemIdentifier, languageIdentifier); - await _client.PublishContentItemVariant(variantIdentifier); + await _client.PublishLanguageVariant(variantIdentifier); - await _client.ScheduleUnpublishingOfContentItemVariant(variantIdentifier, new ScheduleModel { ScheduleTo = new DateTimeOffset(2050, 1, 1, 10, 10, 0, TimeSpan.FromHours(2)) }); + await _client.ScheduleUnpublishingOfLanguageVariant(variantIdentifier, new ScheduleModel { ScheduleTo = new DateTimeOffset(2050, 1, 1, 10, 10, 0, TimeSpan.FromHours(2)) }); - var updatedVariant = await _client.GetContentItemVariantAsync(variantIdentifier); + var updatedVariant = await _client.GetLanguageVariantAsync(variantIdentifier); Assert.Equal(PUBLISHED_WORKFLOW_STEP_ID, updatedVariant.WorkflowStep.Id); // Cleanup - await _client.UnpublishContentItemVariant(variantIdentifier); + await _client.UnpublishLangaugeVariant(variantIdentifier); var itemToClean = Reference.ByExternalId(externalId); await _client.DeleteContentItemAsync(itemToClean); } @@ -201,12 +201,12 @@ public async void CancelPublishingOfVariant_CancelsPublishingOfVariant() // Test var itemIdentifier = Reference.ByExternalId(externalId); var languageIdentifier = Reference.ByCodename(EXISTING_LANGUAGE_CODENAME); - var variantIdentifier = new ContentItemVariantIdentifier(itemIdentifier, languageIdentifier); + var variantIdentifier = new LanguageVariantIdentifier(itemIdentifier, languageIdentifier); - await _client.SchedulePublishingOfContentItemVariant(variantIdentifier, new ScheduleModel { ScheduleTo = new DateTimeOffset(2050, 1, 1, 10, 10, 0, TimeSpan.FromHours(2)) }); - await _client.CancelPublishingOfContentItemVariant(variantIdentifier); + await _client.SchedulePublishingOfLangaugeVariant(variantIdentifier, new ScheduleModel { ScheduleTo = new DateTimeOffset(2050, 1, 1, 10, 10, 0, TimeSpan.FromHours(2)) }); + await _client.CancelPublishingOfLanguageVariant(variantIdentifier); - var updatedVariant = await _client.GetContentItemVariantAsync(variantIdentifier); + var updatedVariant = await _client.GetLanguageVariantAsync(variantIdentifier); Assert.Equal(DRAFT_WORKFLOW_STEP_ID, updatedVariant.WorkflowStep.Id); @@ -226,13 +226,13 @@ public async void CancelUnpublishingOfVariant_CancelsUnpublishingOfVariant() // Test var itemIdentifier = Reference.ByExternalId(externalId); var languageIdentifier = Reference.ByCodename(EXISTING_LANGUAGE_CODENAME); - var variantIdentifier = new ContentItemVariantIdentifier(itemIdentifier, languageIdentifier); + var variantIdentifier = new LanguageVariantIdentifier(itemIdentifier, languageIdentifier); - await _client.PublishContentItemVariant(variantIdentifier); - await _client.ScheduleUnpublishingOfContentItemVariant(variantIdentifier, new ScheduleModel { ScheduleTo = new DateTimeOffset(2050,1,1,10,10,0, TimeSpan.FromHours(2)) }); - await _client.CancelUnpublishingOfContentItemVariant(variantIdentifier); + await _client.PublishLanguageVariant(variantIdentifier); + await _client.ScheduleUnpublishingOfLanguageVariant(variantIdentifier, new ScheduleModel { ScheduleTo = new DateTimeOffset(2050,1,1,10,10,0, TimeSpan.FromHours(2)) }); + await _client.CancelUnpublishingOfLanguageVariant(variantIdentifier); - var updatedVariant = await _client.GetContentItemVariantAsync(variantIdentifier); + var updatedVariant = await _client.GetLanguageVariantAsync(variantIdentifier); Assert.Equal(PUBLISHED_WORKFLOW_STEP_ID, updatedVariant.WorkflowStep.Id); diff --git a/Kentico.Kontent.Management.Tests/ModelBuildersTests/ModelProviderTests.cs b/Kentico.Kontent.Management.Tests/ModelBuildersTests/ModelProviderTests.cs index 5b096fdac..be30fb4b3 100644 --- a/Kentico.Kontent.Management.Tests/ModelBuildersTests/ModelProviderTests.cs +++ b/Kentico.Kontent.Management.Tests/ModelBuildersTests/ModelProviderTests.cs @@ -28,11 +28,11 @@ public ModelProviderTests() public void GetContentItemVariantModel_ReturnsExpected() { var expected = GetTestModel(); - var model = new ContentItemVariantModel + var model = new LanguageVariantModel { Elements = PrepareMockDynamicResponse(expected) }; - var actual = _modelProvider.GetContentItemVariantModel(model).Elements; + var actual = _modelProvider.GetLanguageVariantModel(model).Elements; Assert.Equal(expected.Title.Value, actual.Title.Value); Assert.Equal(expected.Rating.Value, actual.Rating.Value); @@ -55,7 +55,7 @@ public void GetContentItemVariantUpsertModel_ReturnsExpected() var model = GetTestModel(); var type = model.GetType(); - var upsertVariantElements = _modelProvider.GetContentItemVariantUpsertModel(model).Elements; + var upsertVariantElements = _modelProvider.GetLanguageVariantUpsertModel(model).Elements; var titleValue = upsertVariantElements.SingleOrDefault(elementObject => elementObject.element.id == type.GetProperty(nameof(model.Title))?.GetKontentElementId() diff --git a/Kentico.Kontent.Management.Tests/Modules/ActionInvoker/ActionInvokerTests.cs b/Kentico.Kontent.Management.Tests/Modules/ActionInvoker/ActionInvokerTests.cs index c2ba2f0c6..9bc620662 100644 --- a/Kentico.Kontent.Management.Tests/Modules/ActionInvoker/ActionInvokerTests.cs +++ b/Kentico.Kontent.Management.Tests/Modules/ActionInvoker/ActionInvokerTests.cs @@ -41,7 +41,7 @@ public async Task ActionInvokerSerializeElementContainingZero_SerializedJsonCont var httpClient = new FakeManagementHttpClient(); var actionInvoker = new ActionInvoker(httpClient, new MessageCreator("{api_key}")); - var contentItemVariantUpsertModel = new ContentItemVariantUpsertModel() + var contentItemVariantUpsertModel = new LanguageVariantUpsertModel() { Elements = new List { @@ -53,7 +53,7 @@ public async Task ActionInvokerSerializeElementContainingZero_SerializedJsonCont }, }; - await actionInvoker.InvokeMethodAsync("{endpoint_url}", HttpMethod.Get, contentItemVariantUpsertModel); + await actionInvoker.InvokeMethodAsync("{endpoint_url}", HttpMethod.Get, contentItemVariantUpsertModel); Assert.Equal($"{{\"elements\":[{{\"zero\":{s},\"optZero\":{s}}}]}}", httpClient.requestBody); } diff --git a/Kentico.Kontent.Management.Tests/TestUtils.cs b/Kentico.Kontent.Management.Tests/TestUtils.cs index 8e98271a7..734bab8e0 100644 --- a/Kentico.Kontent.Management.Tests/TestUtils.cs +++ b/Kentico.Kontent.Management.Tests/TestUtils.cs @@ -77,14 +77,14 @@ internal static async Task PrepareTestItem(ManagementClient cl } } - internal static async Task PrepareTestVariant(ManagementClient client, string languageCodename, IEnumerable elements, ContentItemModel item) + internal static async Task PrepareTestVariant(ManagementClient client, string languageCodename, IEnumerable elements, ContentItemModel item) { var addedItemIdentifier = Reference.ByCodename(item.Codename); var addedLanguageIdentifier = Reference.ByCodename(languageCodename); - var addedContentItemLanguageIdentifier = new ContentItemVariantIdentifier(addedItemIdentifier, addedLanguageIdentifier); - var variantUpdateModel = new ContentItemVariantUpsertModel() { Elements = elements }; + var addedContentItemLanguageIdentifier = new LanguageVariantIdentifier(addedItemIdentifier, addedLanguageIdentifier); + var variantUpdateModel = new LanguageVariantUpsertModel() { Elements = elements }; - return await client.UpsertContentItemVariantAsync(addedContentItemLanguageIdentifier, variantUpdateModel); + return await client.UpsertLanguageVariantAsync(addedContentItemLanguageIdentifier, variantUpdateModel); } } } diff --git a/Kentico.Kontent.Management/ManagementClient.cs b/Kentico.Kontent.Management/ManagementClient.cs index bc9a1ffff..dab07b12c 100644 --- a/Kentico.Kontent.Management/ManagementClient.cs +++ b/Kentico.Kontent.Management/ManagementClient.cs @@ -85,11 +85,11 @@ internal ManagementClient(EndpointUrlBuilder urlBuilder, ActionInvoker actionInv #region Variants /// - /// Returns strongly typed listing of content item variants for specified content item. + /// Returns strongly typed listing of language variants for specified content item. /// /// The identifier of the content item. - /// The instance that represents the listing of content item variants. - public async Task> ListContentItemVariantsAsync(Reference identifier) + /// The instance that represents the listing of language variants. + public async Task> ListLanguageVariantsAsync(Reference identifier) { if (identifier == null) { @@ -97,17 +97,17 @@ public async Task> ListContentItemVariantsA } var endpointUrl = _urlBuilder.BuildListVariantsUrl(identifier); - var response = await _actionInvoker.InvokeReadOnlyMethodAsync>(endpointUrl, HttpMethod.Get); + var response = await _actionInvoker.InvokeReadOnlyMethodAsync>(endpointUrl, HttpMethod.Get); return response; } /// - /// Returns strongly typed content item variant. + /// Returns strongly typed language variant. /// - /// The identifier of the content item variant. - /// The instance that represents content item variant. - public async Task GetContentItemVariantAsync(ContentItemVariantIdentifier identifier) + /// The identifier of the language variant. + /// The instance that represents language variant. + public async Task GetLanguageVariantAsync(LanguageVariantIdentifier identifier) { if (identifier == null) { @@ -115,40 +115,40 @@ public async Task GetContentItemVariantAsync(ContentIte } var endpointUrl = _urlBuilder.BuildVariantsUrl(identifier); - var response = await _actionInvoker.InvokeReadOnlyMethodAsync(endpointUrl, HttpMethod.Get); + var response = await _actionInvoker.InvokeReadOnlyMethodAsync(endpointUrl, HttpMethod.Get); return response; } /// - /// Inserts or updates given content item variant. + /// Inserts or updates given language variant. /// - /// The identifier of the content item variant. - /// Represents inserted or updated content item variant. - /// The instance that represents inserted or updated content item variant. - public async Task UpsertContentItemVariantAsync(ContentItemVariantIdentifier identifier, ContentItemVariantUpsertModel contentItemVariantUpsertModel) + /// The identifier of the language variant. + /// Represents inserted or updated language variant. + /// The instance that represents inserted or updated language variant. + public async Task UpsertLanguageVariantAsync(LanguageVariantIdentifier identifier, LanguageVariantUpsertModel languageVariantUpsertModel) { if (identifier == null) { throw new ArgumentNullException(nameof(identifier)); } - if (contentItemVariantUpsertModel == null) + if (languageVariantUpsertModel == null) { - throw new ArgumentNullException(nameof(contentItemVariantUpsertModel)); + throw new ArgumentNullException(nameof(languageVariantUpsertModel)); } var endpointUrl = _urlBuilder.BuildVariantsUrl(identifier); - var response = await _actionInvoker.InvokeMethodAsync(endpointUrl, HttpMethod.Put, contentItemVariantUpsertModel); + var response = await _actionInvoker.InvokeMethodAsync(endpointUrl, HttpMethod.Put, languageVariantUpsertModel); return response; } /// - /// Deletes given content item variant. + /// Deletes given language variant. /// - /// The identifier of the content item variant. - public async Task DeleteContentItemVariantAsync(ContentItemVariantIdentifier identifier) + /// The identifier of the language variant. + public async Task DeleteLanguageVariantAsync(LanguageVariantIdentifier identifier) { if (identifier == null) { @@ -619,10 +619,10 @@ public async Task ChangeWorkflowStep(WorkflowIdentifier identifier) } /// - /// Publishes the content item variant. + /// Publishes the language variant. /// - /// The content item variant to be published. - public async Task PublishContentItemVariant(ContentItemVariantIdentifier identifier) + /// The language variant to be published. + public async Task PublishLanguageVariant(LanguageVariantIdentifier identifier) { if (identifier == null) { @@ -635,11 +635,11 @@ public async Task PublishContentItemVariant(ContentItemVariantIdentifier identif } /// - /// Schedules publishing of the content item variant. + /// Schedules publishing of the language variant. /// - /// The identifier of the content item variant to be published. - /// The time when the content item variant will be published - public async Task SchedulePublishingOfContentItemVariant(ContentItemVariantIdentifier identifier, ScheduleModel scheduleModel) + /// The identifier of the language variant to be published. + /// The time when the language variant will be published + public async Task SchedulePublishingOfLangaugeVariant(LanguageVariantIdentifier identifier, ScheduleModel scheduleModel) { if (identifier == null) { @@ -652,10 +652,10 @@ public async Task SchedulePublishingOfContentItemVariant(ContentItemVariantIdent } /// - /// Cancels publishing of the content item variant. + /// Cancels publishing of the language variant. /// - /// The identifier of the content item variant identifier of which publishing should be canceled. - public async Task CancelPublishingOfContentItemVariant(ContentItemVariantIdentifier identifier) + /// The identifier of the language variant identifier of which publishing should be canceled. + public async Task CancelPublishingOfLanguageVariant(LanguageVariantIdentifier identifier) { if (identifier == null) { @@ -668,10 +668,10 @@ public async Task CancelPublishingOfContentItemVariant(ContentItemVariantIdentif } /// - /// Unpublishes the content item variant. + /// Unpublishes the language variant. /// - /// The content item variant to be unpublished. - public async Task UnpublishContentItemVariant(ContentItemVariantIdentifier identifier) + /// The language variant to be unpublished. + public async Task UnpublishLangaugeVariant(LanguageVariantIdentifier identifier) { if (identifier == null) { @@ -684,10 +684,10 @@ public async Task UnpublishContentItemVariant(ContentItemVariantIdentifier ident } /// - /// Cancels unpublishing of the content item variant. + /// Cancels unpublishing of the language variant. /// - /// The identifier of the content item variant identifier of which unpublishing should be canceled. - public async Task CancelUnpublishingOfContentItemVariant(ContentItemVariantIdentifier identifier) + /// The identifier of the language variant identifier of which unpublishing should be canceled. + public async Task CancelUnpublishingOfLanguageVariant(LanguageVariantIdentifier identifier) { if (identifier == null) { @@ -700,11 +700,11 @@ public async Task CancelUnpublishingOfContentItemVariant(ContentItemVariantIdent } /// - /// Schedules unpublishing of the content item variant. + /// Schedules unpublishing of the language variant. /// - /// The identifier of the content item variant to be unpublished. - /// The time when the content item variant will be unpublished - public async Task ScheduleUnpublishingOfContentItemVariant(ContentItemVariantIdentifier identifier, ScheduleModel scheduleModel) + /// The identifier of the language variant to be unpublished. + /// The time when the language variant will be unpublished + public async Task ScheduleUnpublishingOfLanguageVariant(LanguageVariantIdentifier identifier, ScheduleModel scheduleModel) { if (identifier == null) { @@ -717,10 +717,10 @@ public async Task ScheduleUnpublishingOfContentItemVariant(ContentItemVariantIde } /// - /// Creates the new version of the content item variant. + /// Creates the new version of the language variant. /// - /// The identifier of the content item variant for which the new version should created . - public async Task CreateNewVersionOfContentItemVariant(ContentItemVariantIdentifier identifier) + /// The identifier of the language variant for which the new version should created . + public async Task CreateNewVersionOfLanguageVariant(LanguageVariantIdentifier identifier) { if (identifier == null) { @@ -736,12 +736,12 @@ public async Task CreateNewVersionOfContentItemVariant(ContentItemVariantIdentif #region Strongly typed Variants /// - /// Returns strongly typed listing of content item variants with strongly typed elements for specified content item. + /// Returns strongly typed listing of language variants with strongly typed elements for specified content item. /// /// Type of the content item elements /// The identifier of the content item. - /// A strongly-typed collection with content item variants. - public async Task>> ListContentItemVariantsAsync(Reference identifier) where T : new() + /// A strongly-typed collection with language variants. + public async Task>> ListLanguageVariantsAsync(Reference identifier) where T : new() { if (identifier == null) { @@ -749,18 +749,18 @@ public async Task CreateNewVersionOfContentItemVariant(ContentItemVariantIdentif } var endpointUrl = _urlBuilder.BuildListVariantsUrl(identifier); - var response = await _actionInvoker.InvokeReadOnlyMethodAsync>(endpointUrl, HttpMethod.Get); + var response = await _actionInvoker.InvokeReadOnlyMethodAsync>(endpointUrl, HttpMethod.Get); - return response.Select(x => _modelProvider.GetContentItemVariantModel(x)).ToList(); + return response.Select(x => _modelProvider.GetLanguageVariantModel(x)).ToList(); } /// - /// Returns strongly typed content item variant with strongly typed elements. + /// Returns strongly typed language variant with strongly typed elements. /// /// Type of the content item elements - /// The identifier of the content item variant. - /// The instance that represents content item variant. - public async Task> GetContentItemVariantAsync(ContentItemVariantIdentifier identifier) where T : new() + /// The identifier of the language variant. + /// The instance that represents language variant. + public async Task> GetLangaugeVariantAsync(LanguageVariantIdentifier identifier) where T : new() { if (identifier == null) { @@ -768,19 +768,19 @@ public async Task CreateNewVersionOfContentItemVariant(ContentItemVariantIdentif } var endpointUrl = _urlBuilder.BuildVariantsUrl(identifier); - var response = await _actionInvoker.InvokeReadOnlyMethodAsync(endpointUrl, HttpMethod.Get); + var response = await _actionInvoker.InvokeReadOnlyMethodAsync(endpointUrl, HttpMethod.Get); - return _modelProvider.GetContentItemVariantModel(response); + return _modelProvider.GetLanguageVariantModel(response); } /// - /// Inserts or updates given content item variant. + /// Inserts or updates given language variant. /// /// Type of the content item elements - /// The identifier of the content item variant. - /// Represents inserted or updated strongly typed content item variant elements. - /// The instance that represents inserted or updated content item variant. - public async Task> UpsertContentItemVariantAsync(ContentItemVariantIdentifier identifier, T variantElements) where T : new() + /// The identifier of the language variant. + /// Represents inserted or updated strongly typed language variant elements. + /// The instance that represents inserted or updated language variant. + public async Task> UpsertLanguageVariantAsync(LanguageVariantIdentifier identifier, T variantElements) where T : new() { if (identifier == null) { @@ -793,10 +793,10 @@ public async Task CreateNewVersionOfContentItemVariant(ContentItemVariantIdentif } var endpointUrl = _urlBuilder.BuildVariantsUrl(identifier); - var variantUpsertModel = _modelProvider.GetContentItemVariantUpsertModel(variantElements); - var response = await _actionInvoker.InvokeMethodAsync(endpointUrl, HttpMethod.Put, variantUpsertModel); + var variantUpsertModel = _modelProvider.GetLanguageVariantUpsertModel(variantElements); + var response = await _actionInvoker.InvokeMethodAsync(endpointUrl, HttpMethod.Put, variantUpsertModel); - return _modelProvider.GetContentItemVariantModel(response); + return _modelProvider.GetLanguageVariantModel(response); } #endregion diff --git a/Kentico.Kontent.Management/ManagementClientExtensions.cs b/Kentico.Kontent.Management/ManagementClientExtensions.cs index 3b118d576..2bb2fbfa1 100644 --- a/Kentico.Kontent.Management/ManagementClientExtensions.cs +++ b/Kentico.Kontent.Management/ManagementClientExtensions.cs @@ -43,8 +43,8 @@ public static async Task UpdateContentItemAsync(this Managemen /// Content management client instance. /// Identifies which content item variant will be created or updated. /// Specifies data for created ur updated content item variant. - /// The instance that represents created or updated content item variant. - public static async Task UpsertContentItemVariantAsync(this ManagementClient client, ContentItemVariantIdentifier identifier, ContentItemVariantModel contentItemVariant) + /// The instance that represents created or updated content item variant. + public static async Task UpsertContentItemVariantAsync(this ManagementClient client, LanguageVariantIdentifier identifier, LanguageVariantModel contentItemVariant) { if (identifier == null) { @@ -56,9 +56,9 @@ public static async Task UpsertContentItemVariantAsync( throw new ArgumentNullException(nameof(contentItemVariant)); } - var contentItemVariantUpsertModel = new ContentItemVariantUpsertModel(contentItemVariant); + var contentItemVariantUpsertModel = new LanguageVariantUpsertModel(contentItemVariant); - return await client.UpsertContentItemVariantAsync(identifier, contentItemVariantUpsertModel); + return await client.UpsertLanguageVariantAsync(identifier, contentItemVariantUpsertModel); } /// diff --git a/Kentico.Kontent.Management/Models/LanguageVariants/ContentItemVariantIdentifier.cs b/Kentico.Kontent.Management/Models/LanguageVariants/LanguageVariantIdentifier.cs similarity index 69% rename from Kentico.Kontent.Management/Models/LanguageVariants/ContentItemVariantIdentifier.cs rename to Kentico.Kontent.Management/Models/LanguageVariants/LanguageVariantIdentifier.cs index 7018b1156..5b3769467 100644 --- a/Kentico.Kontent.Management/Models/LanguageVariants/ContentItemVariantIdentifier.cs +++ b/Kentico.Kontent.Management/Models/LanguageVariants/LanguageVariantIdentifier.cs @@ -3,12 +3,12 @@ namespace Kentico.Kontent.Management.Models.LanguageVariants { /// - /// Represents identifier of the content item variant. + /// Represents identifier of the langueage variant. /// - public sealed class ContentItemVariantIdentifier + public sealed class LanguageVariantIdentifier { /// - /// Represents identifier of the content item variant. + /// Represents identifier of the language variant. /// public Reference ItemIdentifier { get; private set; } @@ -18,11 +18,11 @@ public sealed class ContentItemVariantIdentifier public Reference LanguageIdentifier { get; private set; } /// - /// Creates instance of content item variant identifier. + /// Creates instance of language variant identifier. /// /// The identifier of the content item. /// The identifier of the language. - public ContentItemVariantIdentifier(Reference itemIdentifier, Reference languageIdentifier) + public LanguageVariantIdentifier(Reference itemIdentifier, Reference languageIdentifier) { ItemIdentifier = itemIdentifier; LanguageIdentifier = languageIdentifier; diff --git a/Kentico.Kontent.Management/Models/LanguageVariants/ContentItemVariantModel.cs b/Kentico.Kontent.Management/Models/LanguageVariants/LanguageVariantModel.cs similarity index 82% rename from Kentico.Kontent.Management/Models/LanguageVariants/ContentItemVariantModel.cs rename to Kentico.Kontent.Management/Models/LanguageVariants/LanguageVariantModel.cs index 558476bee..d0d3df31b 100644 --- a/Kentico.Kontent.Management/Models/LanguageVariants/ContentItemVariantModel.cs +++ b/Kentico.Kontent.Management/Models/LanguageVariants/LanguageVariantModel.cs @@ -6,9 +6,9 @@ namespace Kentico.Kontent.Management.Models.LanguageVariants { /// - /// Represents content item variant model. + /// Represents language variant model. /// - public sealed class ContentItemVariantModel + public sealed class LanguageVariantModel { /// /// Gets or sets item of the variant. @@ -29,13 +29,13 @@ public sealed class ContentItemVariantModel public Reference Language { get; set; } /// - /// Gets or sets last modified timestamp of the content item. + /// Gets or sets last modified timestamp of the language variant. /// [JsonProperty("last_modified")] public DateTime? LastModified { get; set; } /// - /// Gets or sets workflow steps of the content item. + /// Gets or sets workflow steps of the language variant. /// [JsonProperty("workflow_step")] public Reference WorkflowStep { get; set; } diff --git a/Kentico.Kontent.Management/Models/LanguageVariants/ContentItemVariantUpsertModel.cs b/Kentico.Kontent.Management/Models/LanguageVariants/LanguageVariantUpsertModel.cs similarity index 62% rename from Kentico.Kontent.Management/Models/LanguageVariants/ContentItemVariantUpsertModel.cs rename to Kentico.Kontent.Management/Models/LanguageVariants/LanguageVariantUpsertModel.cs index 3c00ac7b6..1b03bd8ac 100644 --- a/Kentico.Kontent.Management/Models/LanguageVariants/ContentItemVariantUpsertModel.cs +++ b/Kentico.Kontent.Management/Models/LanguageVariants/LanguageVariantUpsertModel.cs @@ -4,9 +4,9 @@ namespace Kentico.Kontent.Management.Models.LanguageVariants { /// - /// Represents content item variant upsert model. + /// Represents language variant upsert model. /// - public sealed class ContentItemVariantUpsertModel + public sealed class LanguageVariantUpsertModel { /// /// Gets or sets elements of the variant. @@ -15,13 +15,13 @@ public sealed class ContentItemVariantUpsertModel public IEnumerable Elements { get; set; } /// - /// Creates instance of content item variant upsert model. + /// Creates instance of language variant upsert model. /// - public ContentItemVariantUpsertModel() + public LanguageVariantUpsertModel() { } - internal ContentItemVariantUpsertModel(ContentItemVariantModel contentItemVariant) + internal LanguageVariantUpsertModel(LanguageVariantModel contentItemVariant) { Elements = contentItemVariant.Elements; } diff --git a/Kentico.Kontent.Management/Models/StronglyTyped/ContentItemVariantModel.cs b/Kentico.Kontent.Management/Models/StronglyTyped/LanguageVariantModel.cs similarity index 81% rename from Kentico.Kontent.Management/Models/StronglyTyped/ContentItemVariantModel.cs rename to Kentico.Kontent.Management/Models/StronglyTyped/LanguageVariantModel.cs index 9b3189786..b58057bf3 100644 --- a/Kentico.Kontent.Management/Models/StronglyTyped/ContentItemVariantModel.cs +++ b/Kentico.Kontent.Management/Models/StronglyTyped/LanguageVariantModel.cs @@ -5,9 +5,9 @@ namespace Kentico.Kontent.Management.Models.StronglyTyped { /// - /// Represents strongly typed content item variant model. + /// Represents strongly typed language variant model. /// - public sealed class ContentItemVariantModel where T : new() + public sealed class LanguageVariantModel where T : new() { /// /// Gets or sets item of the variant. @@ -28,7 +28,7 @@ namespace Kentico.Kontent.Management.Models.StronglyTyped public Reference Language { get; set; } /// - /// Gets or sets last modified timestamp of the content item. + /// Gets or sets last modified timestamp of the language variants. /// [JsonProperty("last_modified")] public DateTime? LastModified { get; set; } diff --git a/Kentico.Kontent.Management/Modules/ModelBuilders/IModelProvider.cs b/Kentico.Kontent.Management/Modules/ModelBuilders/IModelProvider.cs index 3818b6556..272ea3173 100644 --- a/Kentico.Kontent.Management/Modules/ModelBuilders/IModelProvider.cs +++ b/Kentico.Kontent.Management/Modules/ModelBuilders/IModelProvider.cs @@ -15,7 +15,7 @@ public interface IModelProvider /// Strongly typed content item model. /// Content item variant data. /// Strongly typed model of the generic type. - ContentItemVariantModel GetContentItemVariantModel(ContentItemVariantModel variant) where T : new(); + LanguageVariantModel GetLanguageVariantModel(LanguageVariantModel variant) where T : new(); /// /// Converts generic upsert model to non-generic model. @@ -23,6 +23,6 @@ public interface IModelProvider /// Strongly typed content item model. /// Strongly typed content item variant data. /// Non-generic model. - ContentItemVariantUpsertModel GetContentItemVariantUpsertModel(T variantElements) where T : new(); + LanguageVariantUpsertModel GetLanguageVariantUpsertModel(T variantElements) where T : new(); } } \ No newline at end of file diff --git a/Kentico.Kontent.Management/Modules/ModelBuilders/ModelProvider.cs b/Kentico.Kontent.Management/Modules/ModelBuilders/ModelProvider.cs index fca9b2ae9..bde56bfea 100644 --- a/Kentico.Kontent.Management/Modules/ModelBuilders/ModelProvider.cs +++ b/Kentico.Kontent.Management/Modules/ModelBuilders/ModelProvider.cs @@ -15,9 +15,9 @@ internal class ModelProvider : IModelProvider { internal ModelProvider() { } - public ContentItemVariantModel GetContentItemVariantModel(ContentItemVariantModel variant) where T : new() + public LanguageVariantModel GetLanguageVariantModel(LanguageVariantModel variant) where T : new() { - var result = new ContentItemVariantModel + var result = new LanguageVariantModel { Item = variant.Item, Language = variant.Language, @@ -51,7 +51,7 @@ internal ModelProvider() { } return result; } - public ContentItemVariantUpsertModel GetContentItemVariantUpsertModel(T variantElements) where T : new() + public LanguageVariantUpsertModel GetLanguageVariantUpsertModel(T variantElements) where T : new() { var type = typeof(T); @@ -64,7 +64,7 @@ internal ModelProvider() { } return element?.ToDynamic(x.GetKontentElementId()); }); - var result = new ContentItemVariantUpsertModel + var result = new LanguageVariantUpsertModel { Elements = elements }; diff --git a/Kentico.Kontent.Management/Modules/UrlBuilder/EndpointUrlBuilder.cs b/Kentico.Kontent.Management/Modules/UrlBuilder/EndpointUrlBuilder.cs index 04c1183bf..f905c1158 100644 --- a/Kentico.Kontent.Management/Modules/UrlBuilder/EndpointUrlBuilder.cs +++ b/Kentico.Kontent.Management/Modules/UrlBuilder/EndpointUrlBuilder.cs @@ -55,7 +55,7 @@ internal string BuildListVariantsUrl(Reference identifier) return GetUrl(string.Concat(itemSegment, _variantTemplate.Url)); } - internal string BuildVariantsUrl(ContentItemVariantIdentifier identifier) + internal string BuildVariantsUrl(LanguageVariantIdentifier identifier) { var itemSegment = GetIdentifierUrlSegment(identifier.ItemIdentifier, _itemTemplate); var variantSegment = GetIdentifierUrlSegment(identifier.LanguageIdentifier, _variantTemplate); @@ -164,7 +164,7 @@ internal string BuildWorkflowChangeUrl(WorkflowIdentifier identifier) return GetUrl(string.Concat(itemSegment, variantSegment, workflowSegment)); } - internal string BuildPublishVariantUrl(ContentItemVariantIdentifier identifier) + internal string BuildPublishVariantUrl(LanguageVariantIdentifier identifier) { var itemSegment = GetIdentifierUrlSegment(identifier.ItemIdentifier, _itemTemplate); var variantSegment = GetIdentifierUrlSegment(identifier.LanguageIdentifier, _variantTemplate); @@ -172,7 +172,7 @@ internal string BuildPublishVariantUrl(ContentItemVariantIdentifier identifier) return GetUrl(string.Concat(itemSegment, variantSegment, "/publish")); } - internal string BuildCancelPublishingVariantUrl(ContentItemVariantIdentifier identifier) + internal string BuildCancelPublishingVariantUrl(LanguageVariantIdentifier identifier) { var itemSegment = GetIdentifierUrlSegment(identifier.ItemIdentifier, _itemTemplate); var variantSegment = GetIdentifierUrlSegment(identifier.LanguageIdentifier, _variantTemplate); @@ -180,7 +180,7 @@ internal string BuildCancelPublishingVariantUrl(ContentItemVariantIdentifier ide return GetUrl(string.Concat(itemSegment, variantSegment, "/cancel-scheduled-publish")); } - internal string BuildUnpublishVariantUrl(ContentItemVariantIdentifier identifier) + internal string BuildUnpublishVariantUrl(LanguageVariantIdentifier identifier) { var itemSegment = GetIdentifierUrlSegment(identifier.ItemIdentifier, _itemTemplate); var variantSegment = GetIdentifierUrlSegment(identifier.LanguageIdentifier, _variantTemplate); @@ -188,7 +188,7 @@ internal string BuildUnpublishVariantUrl(ContentItemVariantIdentifier identifier return GetUrl(string.Concat(itemSegment, variantSegment, "/unpublish-and-archive")); } - internal string BuildCancelUnpublishingVariantUrl(ContentItemVariantIdentifier identifier) + internal string BuildCancelUnpublishingVariantUrl(LanguageVariantIdentifier identifier) { var itemSegment = GetIdentifierUrlSegment(identifier.ItemIdentifier, _itemTemplate); var variantSegment = GetIdentifierUrlSegment(identifier.LanguageIdentifier, _variantTemplate); @@ -196,7 +196,7 @@ internal string BuildCancelUnpublishingVariantUrl(ContentItemVariantIdentifier i return GetUrl(string.Concat(itemSegment, variantSegment, "/cancel-scheduled-unpublish")); } - internal string BuildNewVersionVariantUrl(ContentItemVariantIdentifier identifier) + internal string BuildNewVersionVariantUrl(LanguageVariantIdentifier identifier) { var itemSegment = GetIdentifierUrlSegment(identifier.ItemIdentifier, _itemTemplate); var variantSegment = GetIdentifierUrlSegment(identifier.LanguageIdentifier, _variantTemplate);