diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 93443e23..cd82bde7 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -34,7 +34,7 @@ jobs: - name: Setup .NET Core uses: actions/setup-dotnet@v3 with: - dotnet-version: 6.0.x + dotnet-version: 8.0.x - name: Install dependencies run: dotnet restore - name: Build diff --git a/.github/workflows/integrate.yml b/.github/workflows/integrate.yml index d285d8d3..dd590562 100644 --- a/.github/workflows/integrate.yml +++ b/.github/workflows/integrate.yml @@ -16,7 +16,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: 6.0.x + dotnet-version: 8.0.x - name: Restore dependencies run: dotnet restore - name: Build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index da3e533a..3b631083 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,7 +13,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: 6.0.x + dotnet-version: 8.0.x - name: Extract version from tag id: get_version uses: battila7/get-version-action@v2 diff --git a/Kontent.Ai.Delivery.Abstractions.Tests/Kontent.Ai.Delivery.Abstractions.Tests.csproj b/Kontent.Ai.Delivery.Abstractions.Tests/Kontent.Ai.Delivery.Abstractions.Tests.csproj index 020e4f5f..2d5aaa7f 100644 --- a/Kontent.Ai.Delivery.Abstractions.Tests/Kontent.Ai.Delivery.Abstractions.Tests.csproj +++ b/Kontent.Ai.Delivery.Abstractions.Tests/Kontent.Ai.Delivery.Abstractions.Tests.csproj @@ -1,7 +1,7 @@  - net6.0 + net8.0 false diff --git a/Kontent.Ai.Delivery.Abstractions/Configuration/DeliveryOptions.cs b/Kontent.Ai.Delivery.Abstractions/Configuration/DeliveryOptions.cs index f43d1f1f..777ab1a1 100644 --- a/Kontent.Ai.Delivery.Abstractions/Configuration/DeliveryOptions.cs +++ b/Kontent.Ai.Delivery.Abstractions/Configuration/DeliveryOptions.cs @@ -18,9 +18,9 @@ public class DeliveryOptions public string PreviewEndpoint { get; set; } = "https://preview-deliver.kontent.ai/"; /// - /// Gets or sets the project identifier. + /// Gets or sets the environment identifier. /// - public string ProjectId { get; set; } + public string EnvironmentId { get; set; } /// /// Gets or sets the API key that is used to retrieve content with the Preview API. diff --git a/Kontent.Ai.Delivery.Abstractions/DeliveryClientExtensions.cs b/Kontent.Ai.Delivery.Abstractions/DeliveryClientExtensions.cs index ab38377b..9a97af80 100644 --- a/Kontent.Ai.Delivery.Abstractions/DeliveryClientExtensions.cs +++ b/Kontent.Ai.Delivery.Abstractions/DeliveryClientExtensions.cs @@ -67,7 +67,7 @@ public static Task GetTaxonomiesAsync(this IDe } /// - /// Returns all active languages assigned to a given project and matching the optional filtering parameters. + /// Returns all active languages assigned to a given environment and matching the optional filtering parameters. /// /// An instance of the /// An array that contains zero or more query parameters, for example, for paging. diff --git a/Kontent.Ai.Delivery.Abstractions/Extensions/DeliveryOptionsExtensions.cs b/Kontent.Ai.Delivery.Abstractions/Extensions/DeliveryOptionsExtensions.cs index 92722f70..c81c5560 100644 --- a/Kontent.Ai.Delivery.Abstractions/Extensions/DeliveryOptionsExtensions.cs +++ b/Kontent.Ai.Delivery.Abstractions/Extensions/DeliveryOptionsExtensions.cs @@ -12,7 +12,7 @@ public static class DeliveryOptionsExtensions /// A source. public static void Configure(this DeliveryOptions o, DeliveryOptions options) { - o.ProjectId = options.ProjectId; + o.EnvironmentId = options.EnvironmentId; o.ProductionEndpoint = options.ProductionEndpoint; o.PreviewEndpoint = options.PreviewEndpoint; o.PreviewApiKey = options.PreviewApiKey; diff --git a/Kontent.Ai.Delivery.Abstractions/IDeliveryClient.cs b/Kontent.Ai.Delivery.Abstractions/IDeliveryClient.cs index ae618262..5abbf94a 100644 --- a/Kontent.Ai.Delivery.Abstractions/IDeliveryClient.cs +++ b/Kontent.Ai.Delivery.Abstractions/IDeliveryClient.cs @@ -71,7 +71,7 @@ public interface IDeliveryClient /// - /// Returns all active languages assigned to a given project and matching the optional filtering parameters. + /// Returns all active languages assigned to a given environment and matching the optional filtering parameters. /// /// A collection of query parameters, for example, for paging. /// The instance that represents the languages. If no query parameters are specified, all languages are returned. @@ -85,7 +85,7 @@ public interface IDeliveryClient Task PostSyncInitAsync(IEnumerable parameters = null); /// - /// Retrieve a list of delta updates to recently changed content items in the specified project. The types of items you get is determined by the X-Continuation token you use. + /// Retrieve a list of delta updates to recently changed content items in the specified environment. The types of items you get is determined by the X-Continuation token you use. /// /// The instance that represents the sync response that contains collection of delta updates and continuation token needed for further sync execution. Task GetSyncAsync(string continuationToken); diff --git a/Kontent.Ai.Delivery.Abstractions/Kontent.Ai.Delivery.Abstractions.csproj b/Kontent.Ai.Delivery.Abstractions/Kontent.Ai.Delivery.Abstractions.csproj index b8a1023e..aeb18463 100644 --- a/Kontent.Ai.Delivery.Abstractions/Kontent.Ai.Delivery.Abstractions.csproj +++ b/Kontent.Ai.Delivery.Abstractions/Kontent.Ai.Delivery.Abstractions.csproj @@ -1,7 +1,7 @@  - net6.0 + net8.0 Kontent s.r.o. Kontent s.r.o. Kontent.ai diff --git a/Kontent.Ai.Delivery.Benchmarks/DeliveryClientBenchmark.cs b/Kontent.Ai.Delivery.Benchmarks/DeliveryClientBenchmark.cs index cf545977..c9ec9e74 100644 --- a/Kontent.Ai.Delivery.Benchmarks/DeliveryClientBenchmark.cs +++ b/Kontent.Ai.Delivery.Benchmarks/DeliveryClientBenchmark.cs @@ -18,8 +18,8 @@ public class DeliveryClientBenchmark [GlobalSetup] public async Task Setup() { - var projectId = Guid.NewGuid(); - var baseUrl = $"https://deliver.kontent.ai/{projectId}"; + var environmentId = Guid.NewGuid(); + var baseUrl = $"https://deliver.kontent.ai/{environmentId}"; var mockHttp = new MockHttpMessageHandler(); mockHttp @@ -32,7 +32,7 @@ public async Task Setup() .Respond("application/json", await File.ReadAllTextAsync(Path.Combine(Environment.CurrentDirectory, $"Fixtures{Path.DirectorySeparatorChar}full_articles.json"))); - _client = DeliveryClientBuilder.WithProjectId(projectId).WithTypeProvider(new CustomTypeProvider()).WithDeliveryHttpClient(new DeliveryHttpClient(mockHttp.ToHttpClient())).Build(); + _client = DeliveryClientBuilder.WithEnvironmentId(environmentId).WithTypeProvider(new CustomTypeProvider()).WithDeliveryHttpClient(new DeliveryHttpClient(mockHttp.ToHttpClient())).Build(); } [Benchmark] diff --git a/Kontent.Ai.Delivery.Benchmarks/Kontent.Ai.Delivery.Benchmarks.csproj b/Kontent.Ai.Delivery.Benchmarks/Kontent.Ai.Delivery.Benchmarks.csproj index eec47dba..d139aff5 100644 --- a/Kontent.Ai.Delivery.Benchmarks/Kontent.Ai.Delivery.Benchmarks.csproj +++ b/Kontent.Ai.Delivery.Benchmarks/Kontent.Ai.Delivery.Benchmarks.csproj @@ -1,7 +1,7 @@  - net6.0 + net8.0 Exe false false diff --git a/Kontent.Ai.Delivery.Caching.Tests/BinarySerializationTests.cs b/Kontent.Ai.Delivery.Caching.Tests/BinarySerializationTests.cs index 845f321a..b9b1553f 100644 --- a/Kontent.Ai.Delivery.Caching.Tests/BinarySerializationTests.cs +++ b/Kontent.Ai.Delivery.Caching.Tests/BinarySerializationTests.cs @@ -13,15 +13,15 @@ namespace Kontent.Ai.Delivery.Caching.Tests { public class BinarySerializationTests { - private readonly Guid _projectId; + private readonly Guid _environmentId; private readonly string _baseUrl; private readonly MockHttpMessageHandler _mockHttp; public BinarySerializationTests() { - _projectId = Guid.NewGuid(); - var projectId = _projectId.ToString(); - _baseUrl = $"https://deliver.kontent.ai/{projectId}"; + _environmentId = Guid.NewGuid(); + var environmentId = _environmentId.ToString(); + _baseUrl = $"https://deliver.kontent.ai/{environmentId}"; _mockHttp = new MockHttpMessageHandler(); } @@ -35,7 +35,7 @@ public async void GetItemAsync_SerializeAndDeserialize() .When(url) .Respond("application/json", await File.ReadAllTextAsync(Path.Combine(Environment.CurrentDirectory, $"Fixtures{Path.DirectorySeparatorChar}brazil_natural_barra_grande.json"))); - var client = DeliveryClientBuilder.WithProjectId(_projectId).WithTypeProvider(new CustomTypeProvider()).WithDeliveryHttpClient(new DeliveryHttpClient(_mockHttp.ToHttpClient())).Build(); + var client = DeliveryClientBuilder.WithEnvironmentId(_environmentId).WithTypeProvider(new CustomTypeProvider()).WithDeliveryHttpClient(new DeliveryHttpClient(_mockHttp.ToHttpClient())).Build(); // Act var response = await client.GetItemAsync("brazil_natural_barra_grande"); @@ -62,7 +62,7 @@ public async void GetItemsAsync_SerializeAndDeserialize() .Respond("application/json", await File.ReadAllTextAsync(Path.Combine(Environment.CurrentDirectory, $"Fixtures{Path.DirectorySeparatorChar}full_articles.json"))); - var client = DeliveryClientBuilder.WithProjectId(_projectId).WithTypeProvider(new CustomTypeProvider()).WithDeliveryHttpClient(new DeliveryHttpClient(_mockHttp.ToHttpClient())).Build(); + var client = DeliveryClientBuilder.WithEnvironmentId(_environmentId).WithTypeProvider(new CustomTypeProvider()).WithDeliveryHttpClient(new DeliveryHttpClient(_mockHttp.ToHttpClient())).Build(); // Act var response = await client.GetItemsAsync
(); diff --git a/Kontent.Ai.Delivery.Caching.Tests/Kontent.Ai.Delivery.Caching.Tests.csproj b/Kontent.Ai.Delivery.Caching.Tests/Kontent.Ai.Delivery.Caching.Tests.csproj index d8ef8d06..aabf69f2 100644 --- a/Kontent.Ai.Delivery.Caching.Tests/Kontent.Ai.Delivery.Caching.Tests.csproj +++ b/Kontent.Ai.Delivery.Caching.Tests/Kontent.Ai.Delivery.Caching.Tests.csproj @@ -1,7 +1,7 @@  - net6.0 + net8.0 false diff --git a/Kontent.Ai.Delivery.Caching.Tests/ScenarioBuilder.cs b/Kontent.Ai.Delivery.Caching.Tests/ScenarioBuilder.cs index 1b302b93..f6c80522 100644 --- a/Kontent.Ai.Delivery.Caching.Tests/ScenarioBuilder.cs +++ b/Kontent.Ai.Delivery.Caching.Tests/ScenarioBuilder.cs @@ -16,7 +16,7 @@ namespace Kontent.Ai.Delivery.Caching.Tests { public class ScenarioBuilder { - private readonly string _projectId = Guid.NewGuid().ToString(); + private readonly string _environmentId = Guid.NewGuid().ToString(); private readonly string _baseUrl; private readonly CacheTypeEnum _cacheType; private readonly CacheExpirationType _cacheExpirationType; @@ -36,7 +36,7 @@ public ScenarioBuilder( DistributedCacheResilientPolicy distributedCacheResilientPolicy = DistributedCacheResilientPolicy.Crash, ILoggerFactory loggerFactory = null) { - _baseUrl = $"https://deliver.kontent.ai/{_projectId}/"; + _baseUrl = $"https://deliver.kontent.ai/{_environmentId}/"; _cacheType = cacheType; _cacheExpirationType = cacheExpirationType; _distributedCacheResilientPolicy = distributedCacheResilientPolicy; @@ -108,11 +108,11 @@ public Scenario Build() } if (_cacheType == CacheTypeEnum.Memory) { - return new Scenario(_memoryCache, _cacheExpirationType, mockHttp.ToHttpClient(), new DeliveryOptions { ProjectId = _projectId }, _requestCounter); + return new Scenario(_memoryCache, _cacheExpirationType, mockHttp.ToHttpClient(), new DeliveryOptions { EnvironmentId = _environmentId }, _requestCounter); } else { - return new Scenario(_distributedCache, _cacheExpirationType, _distributedCacheResilientPolicy, mockHttp.ToHttpClient(), new DeliveryOptions { ProjectId = _projectId }, _requestCounter, _loggerFactory); + return new Scenario(_distributedCache, _cacheExpirationType, _distributedCacheResilientPolicy, mockHttp.ToHttpClient(), new DeliveryOptions { EnvironmentId = _environmentId }, _requestCounter, _loggerFactory); } } } diff --git a/Kontent.Ai.Delivery.Caching.Tests/ServiceCollectionExtensionsTests.cs b/Kontent.Ai.Delivery.Caching.Tests/ServiceCollectionExtensionsTests.cs index 777b5cef..684de462 100644 --- a/Kontent.Ai.Delivery.Caching.Tests/ServiceCollectionExtensionsTests.cs +++ b/Kontent.Ai.Delivery.Caching.Tests/ServiceCollectionExtensionsTests.cs @@ -43,7 +43,7 @@ public void AddDeliveryClientCacheWitNoPreviousRegistrationDeliveryClient_Throws [InlineData(CacheTypeEnum.Distributed)] public void AddDeliveryClient_WithNoCache_GetClient(CacheTypeEnum cacheType) { - _serviceCollection.AddDeliveryClient(new DeliveryOptions() { ProjectId = Guid.NewGuid().ToString() }); + _serviceCollection.AddDeliveryClient(new DeliveryOptions() { EnvironmentId = Guid.NewGuid().ToString() }); _serviceCollection.AddDeliveryClientCache(new DeliveryCacheOptions() { CacheType = cacheType @@ -62,7 +62,7 @@ public void AddDeliveryClient_WithNoCache_GetClient(CacheTypeEnum cacheType) [InlineData(CacheTypeEnum.Distributed)] public void AddDeliveryClient_CacheWithDeliveryCacheOptions_ThrowsNotImeplementException(CacheTypeEnum cacheType) { - _serviceCollection.AddDeliveryClient(new DeliveryOptions() { ProjectId = Guid.NewGuid().ToString() }); + _serviceCollection.AddDeliveryClient(new DeliveryOptions() { EnvironmentId = Guid.NewGuid().ToString() }); _serviceCollection.AddDeliveryClientCache(new DeliveryCacheOptions() { CacheType = cacheType diff --git a/Kontent.Ai.Delivery.Caching/DeliveryClientCache.cs b/Kontent.Ai.Delivery.Caching/DeliveryClientCache.cs index 64b78fb6..6cf19da4 100644 --- a/Kontent.Ai.Delivery.Caching/DeliveryClientCache.cs +++ b/Kontent.Ai.Delivery.Caching/DeliveryClientCache.cs @@ -15,7 +15,7 @@ public class DeliveryClientCache : IDeliveryClient private readonly IDeliveryCacheManager _deliveryCacheManager; /// - /// Initializes a new instance of the class for retrieving cached content of the specified project. + /// Initializes a new instance of the class for retrieving cached content of the specified environment. /// /// /// @@ -168,7 +168,7 @@ public Task PostSyncInitAsync(IEnumerable - /// Retrieve a list of delta updates to recently changed content items in the specified project. The types of items you get is determined by the X-Continuation token you use. + /// Retrieve a list of delta updates to recently changed content items in the specified environment. The types of items you get is determined by the X-Continuation token you use. ///
/// The instance that represents the sync response that contains collection of delta updates and continuation token needed for further sync execution. public Task GetSyncAsync(string continuationToken) diff --git a/Kontent.Ai.Delivery.Caching/Kontent.Ai.Delivery.Caching.csproj b/Kontent.Ai.Delivery.Caching/Kontent.Ai.Delivery.Caching.csproj index 49649a95..2b49e774 100644 --- a/Kontent.Ai.Delivery.Caching/Kontent.Ai.Delivery.Caching.csproj +++ b/Kontent.Ai.Delivery.Caching/Kontent.Ai.Delivery.Caching.csproj @@ -1,7 +1,7 @@ - net6.0 + net8.0 Kontent s.r.o. Kontent s.r.o. Kontent.ai diff --git a/Kontent.Ai.Delivery.Extensions.DependencyInjection.Tests/DeliveryClientFactoryTests.cs b/Kontent.Ai.Delivery.Extensions.DependencyInjection.Tests/DeliveryClientFactoryTests.cs index 8c90551e..86cceebf 100644 --- a/Kontent.Ai.Delivery.Extensions.DependencyInjection.Tests/DeliveryClientFactoryTests.cs +++ b/Kontent.Ai.Delivery.Extensions.DependencyInjection.Tests/DeliveryClientFactoryTests.cs @@ -27,7 +27,7 @@ public DeliveryClientFactoryTests() [Fact] public void GetNamedClient_WithCorrectName_GetClient() { - var deliveryOptions = new DeliveryOptions() { ProjectId = Guid.NewGuid().ToString(), Name = _clientName }; + var deliveryOptions = new DeliveryOptions() { EnvironmentId = Guid.NewGuid().ToString(), Name = _clientName }; A.CallTo(() => _deliveryOptionsMock.Get(_clientName)) .Returns(deliveryOptions); @@ -42,7 +42,7 @@ public void GetNamedClient_WithCorrectName_GetClient() [Fact] public void GetNamedClient_WithWrongName_GetNull() { - var deliveryOptions = new DeliveryOptions() { ProjectId = Guid.NewGuid().ToString() }; + var deliveryOptions = new DeliveryOptions() { EnvironmentId = Guid.NewGuid().ToString() }; A.CallTo(() => _deliveryOptionsMock.Get(_clientName)) .Returns(deliveryOptions); diff --git a/Kontent.Ai.Delivery.Extensions.DependencyInjection.Tests/Kontent.Ai.Delivery.Extensions.DependencyInjection.Tests.csproj b/Kontent.Ai.Delivery.Extensions.DependencyInjection.Tests/Kontent.Ai.Delivery.Extensions.DependencyInjection.Tests.csproj index 75ab4f1b..79cba3c0 100644 --- a/Kontent.Ai.Delivery.Extensions.DependencyInjection.Tests/Kontent.Ai.Delivery.Extensions.DependencyInjection.Tests.csproj +++ b/Kontent.Ai.Delivery.Extensions.DependencyInjection.Tests/Kontent.Ai.Delivery.Extensions.DependencyInjection.Tests.csproj @@ -1,7 +1,7 @@  - net6.0 + net8.0 false diff --git a/Kontent.Ai.Delivery.Extensions.DependencyInjection.Tests/ServiceCollectionExtensionsTests.MultipleDeliveryClientFactory.cs b/Kontent.Ai.Delivery.Extensions.DependencyInjection.Tests/ServiceCollectionExtensionsTests.MultipleDeliveryClientFactory.cs index f62b78e8..3e223e5c 100644 --- a/Kontent.Ai.Delivery.Extensions.DependencyInjection.Tests/ServiceCollectionExtensionsTests.MultipleDeliveryClientFactory.cs +++ b/Kontent.Ai.Delivery.Extensions.DependencyInjection.Tests/ServiceCollectionExtensionsTests.MultipleDeliveryClientFactory.cs @@ -17,7 +17,7 @@ public partial class ServiceCollectionExtensionsTests public class MultipleDeliveryClientFactory { private readonly IServiceCollection _serviceCollection; - private readonly DeliveryOptions _deliveryOptions = new DeliveryOptions { ProjectId = Guid.NewGuid().ToString() }; + private readonly DeliveryOptions _deliveryOptions = new DeliveryOptions { EnvironmentId = Guid.NewGuid().ToString() }; private readonly string _correctName = "correctName"; private readonly string _wrongName = "wrongName"; @@ -267,15 +267,15 @@ public void AddMultipleDeliveryClientFactory_WithTwoClientsWithCustomTypeProvide var typeProviderB = A.Fake(); var clientAName = "Marketing"; var clientBName = "Finance"; - var projectAID = "923850ac-5869-4743-8414-eb278e7beb69"; - var projectBID = "88d518c5-db60-432d-918a-14dba79c63ac"; + var environmentAID = "923850ac-5869-4743-8414-eb278e7beb69"; + var environmentBID = "88d518c5-db60-432d-918a-14dba79c63ac"; _serviceCollection.AddMultipleDeliveryClientFactory( factoryBuilder => factoryBuilder .AddDeliveryClient( clientAName, builder => builder - .WithProjectId(projectAID) + .WithEnvironmentId(environmentAID) .UseProductionApi() .Build(), optionalConfig => optionalConfig @@ -284,7 +284,7 @@ public void AddMultipleDeliveryClientFactory_WithTwoClientsWithCustomTypeProvide .AddDeliveryClient( clientBName, builder => builder - .WithProjectId(projectBID) + .WithEnvironmentId(environmentBID) .UseProductionApi() .Build(), optionalConfig => optionalConfig @@ -324,11 +324,11 @@ public void AddMultipleDeliveryClientFactory_WithTwoClientsWithCustomTypeProvide .GetField("DeliveryOptions", bindingFlags) .GetValue(clientB); - deliveryOptionsA.CurrentValue.ProjectId.Should().Be(projectAID); + deliveryOptionsA.CurrentValue.EnvironmentId.Should().Be(environmentAID); registeredTypeProviderA.Should().Be(typeProviderA); innerRegisteredTypeProviderA.Should().Be(typeProviderA); - deliveryOptionsB.CurrentValue.ProjectId.Should().Be(projectBID); + deliveryOptionsB.CurrentValue.EnvironmentId.Should().Be(environmentBID); registeredTypeProviderB.Should().Be(typeProviderB); innerRegisteredTypeProviderB.Should().Be(typeProviderB); } diff --git a/Kontent.Ai.Delivery.Extensions.DependencyInjection.Tests/ServiceCollectionExtensionsTests.NamedCacheClient.cs b/Kontent.Ai.Delivery.Extensions.DependencyInjection.Tests/ServiceCollectionExtensionsTests.NamedCacheClient.cs index 42c877ae..db2de5cc 100644 --- a/Kontent.Ai.Delivery.Extensions.DependencyInjection.Tests/ServiceCollectionExtensionsTests.NamedCacheClient.cs +++ b/Kontent.Ai.Delivery.Extensions.DependencyInjection.Tests/ServiceCollectionExtensionsTests.NamedCacheClient.cs @@ -14,7 +14,7 @@ public partial class ServiceCollectionExtensionsTests public class NamedCacheClient { private readonly IServiceCollection _serviceCollection; - private readonly DeliveryOptions _deliveryOptions = new DeliveryOptions { ProjectId = Guid.NewGuid().ToString() }; + private readonly DeliveryOptions _deliveryOptions = new DeliveryOptions { EnvironmentId = Guid.NewGuid().ToString() }; private readonly string _correctName = "correctName"; private readonly string _wrongName = "wrongName"; diff --git a/Kontent.Ai.Delivery.Extensions.DependencyInjection.Tests/ServiceCollectionExtensionsTests.NamedClient.cs b/Kontent.Ai.Delivery.Extensions.DependencyInjection.Tests/ServiceCollectionExtensionsTests.NamedClient.cs index ce7bb21c..6f375318 100644 --- a/Kontent.Ai.Delivery.Extensions.DependencyInjection.Tests/ServiceCollectionExtensionsTests.NamedClient.cs +++ b/Kontent.Ai.Delivery.Extensions.DependencyInjection.Tests/ServiceCollectionExtensionsTests.NamedClient.cs @@ -16,7 +16,7 @@ public class NamedClient private readonly IServiceCollection _serviceCollection; private readonly INamedServiceProvider _namedServiceProvider; private readonly IConfiguration _configuration; - private readonly DeliveryOptions _deliveryOptions = new DeliveryOptions { ProjectId = Guid.NewGuid().ToString() }; + private readonly DeliveryOptions _deliveryOptions = new DeliveryOptions { EnvironmentId = Guid.NewGuid().ToString() }; private readonly string _correctName = "correctName"; private readonly string _wrongName = "wrongName"; diff --git a/Kontent.Ai.Delivery.Extensions.DependencyInjection/Kontent.Ai.Delivery.Extensions.DependencyInjection.csproj b/Kontent.Ai.Delivery.Extensions.DependencyInjection/Kontent.Ai.Delivery.Extensions.DependencyInjection.csproj index 4065ca55..25175032 100644 --- a/Kontent.Ai.Delivery.Extensions.DependencyInjection/Kontent.Ai.Delivery.Extensions.DependencyInjection.csproj +++ b/Kontent.Ai.Delivery.Extensions.DependencyInjection/Kontent.Ai.Delivery.Extensions.DependencyInjection.csproj @@ -1,7 +1,7 @@ - net6.0 + net8.0 Kontent s.r.o. Kontent.ai © 2022 Kontent s.r.o. All rights reserved. diff --git a/Kontent.Ai.Delivery.Rx.Tests/DeliveryObservableProxyTests.cs b/Kontent.Ai.Delivery.Rx.Tests/DeliveryObservableProxyTests.cs index 9ead4ed3..9ddd119c 100644 --- a/Kontent.Ai.Delivery.Rx.Tests/DeliveryObservableProxyTests.cs +++ b/Kontent.Ai.Delivery.Rx.Tests/DeliveryObservableProxyTests.cs @@ -191,7 +191,7 @@ private IDeliveryClient GetDeliveryClient(Action mockAction) { mockAction(); var deliveryHttpClient = new DeliveryHttpClient(_mockHttp.ToHttpClient()); - var deliveryOptions = CreateMonitor(new DeliveryOptions { ProjectId = _guid }); + var deliveryOptions = CreateMonitor(new DeliveryOptions { EnvironmentId = _guid }); var contentLinkUrlResolver = A.Fake(); var contentItemsProcessor = A.Fake(); var contentPropertyMapper = new PropertyMapper(); diff --git a/Kontent.Ai.Delivery.Rx.Tests/Fixtures/languages.json b/Kontent.Ai.Delivery.Rx.Tests/Fixtures/languages.json index ace3db0a..b311ff7d 100644 --- a/Kontent.Ai.Delivery.Rx.Tests/Fixtures/languages.json +++ b/Kontent.Ai.Delivery.Rx.Tests/Fixtures/languages.json @@ -3,7 +3,7 @@ { "system": { "id": "00000000-0000-0000-0000-000000000000", - "name": "Default project language", + "name": "Default environment language", "codename": "default" } }, diff --git a/Kontent.Ai.Delivery.Rx.Tests/Kontent.Ai.Delivery.Rx.Tests.csproj b/Kontent.Ai.Delivery.Rx.Tests/Kontent.Ai.Delivery.Rx.Tests.csproj index 147a4d28..31638936 100644 --- a/Kontent.Ai.Delivery.Rx.Tests/Kontent.Ai.Delivery.Rx.Tests.csproj +++ b/Kontent.Ai.Delivery.Rx.Tests/Kontent.Ai.Delivery.Rx.Tests.csproj @@ -1,7 +1,7 @@  - net6.0 + net8.0 false diff --git a/Kontent.Ai.Delivery.Rx/Kontent.Ai.Delivery.Rx.csproj b/Kontent.Ai.Delivery.Rx/Kontent.Ai.Delivery.Rx.csproj index ebac05e1..b532e311 100644 --- a/Kontent.Ai.Delivery.Rx/Kontent.Ai.Delivery.Rx.csproj +++ b/Kontent.Ai.Delivery.Rx/Kontent.Ai.Delivery.Rx.csproj @@ -1,7 +1,7 @@  - net6.0 + net8.0 Kontent s.r.o. Kontent s.r.o. Kontent.ai diff --git a/Kontent.Ai.Delivery.Tests/Builders/Configuration/DeliveryOptionsBuilderTests.cs b/Kontent.Ai.Delivery.Tests/Builders/Configuration/DeliveryOptionsBuilderTests.cs index 92c61e8c..6b54c7ad 100644 --- a/Kontent.Ai.Delivery.Tests/Builders/Configuration/DeliveryOptionsBuilderTests.cs +++ b/Kontent.Ai.Delivery.Tests/Builders/Configuration/DeliveryOptionsBuilderTests.cs @@ -7,7 +7,7 @@ namespace Kontent.Ai.Delivery.Tests.Builders.Configuration { public class DeliveryOptionsBuilderTests { - private const string ProjectId = "550cec62-90a6-4ab3-b3e4-3d0bb4c04f5c"; + private const string EnvironmentId = "550cec62-90a6-4ab3-b3e4-3d0bb4c04f5c"; private const string PreviewApiKey = "eyJ0eXAiOiwq14X65DLCJhbGciOiJIUzI1NiJ-.eyJqdGkiOiABCjJlM2FiOTBjOGM0ODVmYjdmZTDEFRQZGM1NDIyMCIsImlhdCI6IjE1Mjg454wexiLCJleHAiOiIxODc0NDg3NjqasdfwicHJvamVjdF9pZCI6Ij" + "g1OTEwOTlkN2458198ewqewZjI3Yzg5M2FhZTJiNTE4IiwidmVyIjoiMS4wLjAiLCJhdWQiewqgsdaWV3LmRlbGl2ZXIua2VudGljb2Nsb3VkLmNvbSJ9._tSzbNDpbE55dsaLUTGsdgesg4b693TFuhRCRsDyoc"; @@ -15,46 +15,46 @@ public class DeliveryOptionsBuilderTests private const string SecuredApiKey = "eyJ0eXAiOiwq14X65DLCJhbGciOiJIUzI1NiJ9.eyJqdGkiOiABCjJlM2FiOTBjOGM0ODVmYjdmZTDEFRQZGM1ND123QEwclhdCI6IjE1Mjg454wexiLCJleHAiOiIxODc0NDg3NjqasdfwicHJvamVjdF9pZCI6Ij" + "g1OTEwOTlkN2458198ewqewZjI3Yzg5M2FhZTJiNTE4IiwidmVyIjoiMS4wLjAiLCJhdWQiewqgsdaWV3LmRlbGl2ZXIua2VudGljb2Nsb3VkLmNvbSJ9.wtSzbNDpbE55dsaLUTGsdgesg4b693TFuhRCRsDyoc"; - private readonly Guid _guid = new Guid(ProjectId); + private readonly Guid _guid = new Guid(EnvironmentId); [Fact] - public void BuildWithProjectIdAndUseProductionApi() + public void BuildWithEnvironmentIdAndUseProductionApi() { var deliveryOptions = DeliveryOptionsBuilder .CreateInstance() - .WithProjectId(ProjectId) + .WithEnvironmentId(EnvironmentId) .UseProductionApi() .Build(); - Assert.Equal(ProjectId, deliveryOptions.ProjectId); + Assert.Equal(EnvironmentId, deliveryOptions.EnvironmentId); Assert.False(deliveryOptions.UsePreviewApi); Assert.False(deliveryOptions.UseSecureAccess); } [Fact] - public void BuildWithProjectIdAndPreviewApi() + public void BuildWithEnvironmentIdAndPreviewApi() { var deliveryOptions = DeliveryOptionsBuilder .CreateInstance() - .WithProjectId(_guid) + .WithEnvironmentId(_guid) .UsePreviewApi(PreviewApiKey) .Build(); - Assert.Equal(ProjectId, deliveryOptions.ProjectId); + Assert.Equal(EnvironmentId, deliveryOptions.EnvironmentId); Assert.True(deliveryOptions.UsePreviewApi); Assert.Equal(PreviewApiKey, deliveryOptions.PreviewApiKey); } [Fact] - public void BuildWithProjectIdAndSecuredProductionApi() + public void BuildWithEnvironmentIdAndSecuredProductionApi() { var deliveryOptions = DeliveryOptionsBuilder .CreateInstance() - .WithProjectId(ProjectId) + .WithEnvironmentId(EnvironmentId) .UseProductionApi(SecuredApiKey) .Build(); - Assert.Equal(ProjectId, deliveryOptions.ProjectId); + Assert.Equal(EnvironmentId, deliveryOptions.EnvironmentId); Assert.True(deliveryOptions.UseSecureAccess); Assert.Equal(SecuredApiKey, deliveryOptions.SecureAccessApiKey); } @@ -66,7 +66,7 @@ public void BuildWithRetryPolicyOptions() var deliveryOptions = DeliveryOptionsBuilder .CreateInstance() - .WithProjectId(ProjectId) + .WithEnvironmentId(EnvironmentId) .UseProductionApi() .WithDefaultRetryPolicyOptions(retryOptions) .Build(); @@ -79,7 +79,7 @@ public void BuildWithNullRetryPolicyOptions_ThrowsException() { Assert.Throws(() => DeliveryOptionsBuilder .CreateInstance() - .WithProjectId(ProjectId) + .WithEnvironmentId(EnvironmentId) .UseProductionApi() .WithDefaultRetryPolicyOptions(null) .Build()); @@ -90,7 +90,7 @@ public void BuildWithDisabledRetryLogic() { var deliveryOptions = DeliveryOptionsBuilder .CreateInstance() - .WithProjectId(Guid.NewGuid()) + .WithEnvironmentId(Guid.NewGuid()) .UseProductionApi() .DisableRetryPolicy() .Build(); @@ -103,7 +103,7 @@ public void BuildWithWaitForLoadingNewContent() { var deliveryOptions = DeliveryOptionsBuilder .CreateInstance() - .WithProjectId(Guid.NewGuid()) + .WithEnvironmentId(Guid.NewGuid()) .UseProductionApi() .WaitForLoadingNewContent() .Build(); @@ -116,7 +116,7 @@ public void BuildWithIncludeTotalCount() { var deliveryOptions = DeliveryOptionsBuilder .CreateInstance() - .WithProjectId(Guid.NewGuid()) + .WithEnvironmentId(Guid.NewGuid()) .UseProductionApi() .IncludeTotalCount() .Build(); @@ -131,7 +131,7 @@ public void BuildWithCustomEndpointForPreviewApi() var deliveryOptions = DeliveryOptionsBuilder .CreateInstance() - .WithProjectId(ProjectId) + .WithEnvironmentId(EnvironmentId) .UsePreviewApi(PreviewApiKey) .WithCustomEndpoint(customEndpoint) .Build(); @@ -146,7 +146,7 @@ public void BuildWithCustomEndpointForProductionApi() var deliveryOptions = DeliveryOptionsBuilder .CreateInstance() - .WithProjectId(ProjectId) + .WithEnvironmentId(EnvironmentId) .UseProductionApi() .WithCustomEndpoint(customEndpoint) .Build(); @@ -162,7 +162,7 @@ public void BuildWithCustomEndpointAsUriForPreviewApi() var deliveryOptions = DeliveryOptionsBuilder .CreateInstance() - .WithProjectId(ProjectId) + .WithEnvironmentId(EnvironmentId) .UsePreviewApi(PreviewApiKey) .WithCustomEndpoint(uri) .Build(); @@ -178,7 +178,7 @@ public void BuildWithCustomEndpointAsUriForProductionApi() var deliveryOptions = DeliveryOptionsBuilder .CreateInstance() - .WithProjectId(ProjectId) + .WithEnvironmentId(EnvironmentId) .UseProductionApi() .WithCustomEndpoint(uri) .Build(); @@ -193,7 +193,7 @@ public void BuildWithDefaultRenditionPreset() var deliveryOptions = DeliveryOptionsBuilder .CreateInstance() - .WithProjectId(ProjectId) + .WithEnvironmentId(EnvironmentId) .UseProductionApi() .WithDefaultRenditionPreset(renditionPreset) .Build(); diff --git a/Kontent.Ai.Delivery.Tests/Builders/Configuration/DeliveryOptionsValidatorTests.cs b/Kontent.Ai.Delivery.Tests/Builders/Configuration/DeliveryOptionsValidatorTests.cs index dd648c47..7cb56405 100644 --- a/Kontent.Ai.Delivery.Tests/Builders/Configuration/DeliveryOptionsValidatorTests.cs +++ b/Kontent.Ai.Delivery.Tests/Builders/Configuration/DeliveryOptionsValidatorTests.cs @@ -14,7 +14,7 @@ public void ValidateRetryOptions_NegativeDeltaBackoff_Throws() { var deliveryOptions = new DeliveryOptions { - ProjectId = _guid.ToString(), + EnvironmentId = _guid.ToString(), DefaultRetryPolicyOptions = new DefaultRetryPolicyOptions { DeltaBackoff = TimeSpan.FromSeconds(-1) @@ -29,7 +29,7 @@ public void ValidateRetryOptions_ZeroDeltaBackoff_Throws() { var deliveryOptions = new DeliveryOptions { - ProjectId = _guid.ToString(), + EnvironmentId = _guid.ToString(), DefaultRetryPolicyOptions = new DefaultRetryPolicyOptions { DeltaBackoff = TimeSpan.Zero @@ -44,7 +44,7 @@ public void ValidateRetryOptions_NegativeMaxCumulativeWaitTime_Throws() { var deliveryOptions = new DeliveryOptions { - ProjectId = _guid.ToString(), + EnvironmentId = _guid.ToString(), DefaultRetryPolicyOptions = new DefaultRetryPolicyOptions { MaxCumulativeWaitTime = TimeSpan.FromSeconds(-1) @@ -59,7 +59,7 @@ public void ValidateRetryOptions_ZeroMaxCumulativeWaitTime_Throws() { var deliveryOptions = new DeliveryOptions { - ProjectId = _guid.ToString(), + EnvironmentId = _guid.ToString(), DefaultRetryPolicyOptions = new DefaultRetryPolicyOptions { MaxCumulativeWaitTime = TimeSpan.Zero @@ -74,7 +74,7 @@ public void ValidateNullRetryOptions_Throws() { var deliveryOptions = new DeliveryOptions { - ProjectId = _guid.ToString(), + EnvironmentId = _guid.ToString(), DefaultRetryPolicyOptions = null }; @@ -82,17 +82,17 @@ public void ValidateNullRetryOptions_Throws() } [Fact] - public void ValidateOptionsWithEmptyProjectId() + public void ValidateOptionsWithEmptyEnvironmentId() { - var deliveryOptions = new DeliveryOptions {ProjectId = ""}; + var deliveryOptions = new DeliveryOptions {EnvironmentId = ""}; Assert.Throws(() => deliveryOptions.Validate()); } [Fact] - public void ValidateOptionsWithNullProjectId() + public void ValidateOptionsWithNullEnvironmentId() { - var deliveryOptions = new DeliveryOptions { ProjectId = null }; + var deliveryOptions = new DeliveryOptions { EnvironmentId = null }; Assert.Throws(() => deliveryOptions.Validate()); } @@ -100,9 +100,9 @@ public void ValidateOptionsWithNullProjectId() [Theory] [InlineData("123-456")] [InlineData("00000000-0000-0000-0000-000000000000")] - public void ValidateOptionsWithEmptyGuidProjectId(string projectId) + public void ValidateOptionsWithEmptyGuidEnvironmentId(string environmentId) { - var deliveryOptions = new DeliveryOptions { ProjectId = projectId }; + var deliveryOptions = new DeliveryOptions { EnvironmentId = environmentId }; Assert.Throws(() => deliveryOptions.Validate()); } @@ -112,7 +112,7 @@ public void ValidateOptionsWithNullPreviewApiKey() { var deliveryOptionsStep = DeliveryOptionsBuilder .CreateInstance() - .WithProjectId(_guid); + .WithEnvironmentId(_guid); Assert.Throws(() => deliveryOptionsStep.UsePreviewApi(null)); } @@ -122,7 +122,7 @@ public void ValidateOptionsWithNullSecuredApiKey() { var deliveryOptionsStep = DeliveryOptionsBuilder .CreateInstance() - .WithProjectId(_guid); + .WithEnvironmentId(_guid); Assert.Throws(() => deliveryOptionsStep.UseProductionApi(null)); } @@ -132,7 +132,7 @@ public void ValidateOptionsBuiltWithBuilderWithIncorrectApiKeyFormat() { var deliveryOptions = DeliveryOptionsBuilder .CreateInstance() - .WithProjectId(_guid); + .WithEnvironmentId(_guid); Assert.Throws(() => deliveryOptions.UsePreviewApi("badPreviewApiFormat")); } @@ -145,7 +145,7 @@ public void ValidateOptionsUseOfPreviewAndProductionApiSimultaneously() var deliveryOptions = new DeliveryOptions { - ProjectId = _guid.ToString(), + EnvironmentId = _guid.ToString(), UsePreviewApi = true, PreviewApiKey = previewApiKey, UseSecureAccess = true, @@ -160,7 +160,7 @@ public void ValidateOptionsWithEnabledPreviewApiWithSetKey() { var deliveryOptions = new DeliveryOptions { - ProjectId = _guid.ToString(), + EnvironmentId = _guid.ToString(), UsePreviewApi = true }; @@ -172,7 +172,7 @@ public void ValidateOptionsWithEnabledSecuredApiWithSetKey() { var deliveryOptions = new DeliveryOptions { - ProjectId = _guid.ToString(), + EnvironmentId = _guid.ToString(), UseSecureAccess = true }; @@ -187,7 +187,7 @@ public void ValidateOptionsWithInvalidEndpointFormat(string endpoint) { var deliveryOptionsSteps = DeliveryOptionsBuilder .CreateInstance() - .WithProjectId(_guid) + .WithEnvironmentId(_guid) .UseProductionApi(); Assert.Throws(() => deliveryOptionsSteps.WithCustomEndpoint(endpoint)); @@ -198,7 +198,7 @@ public void ValidateOptionsWithNullUriEndpoint() { var deliveryOptionsSteps = DeliveryOptionsBuilder .CreateInstance() - .WithProjectId(_guid) + .WithEnvironmentId(_guid) .UseProductionApi(); Assert.Throws(() => deliveryOptionsSteps.WithCustomEndpoint((Uri)null)); @@ -210,7 +210,7 @@ public void ValidateOptionsWithUriEndpointWrongScheme() var incorrectSchemeUri = new Uri("ftp://www.abc.com"); var deliveryOptionsSteps = DeliveryOptionsBuilder .CreateInstance() - .WithProjectId(_guid) + .WithEnvironmentId(_guid) .UseProductionApi(); Assert.Throws(() => deliveryOptionsSteps.WithCustomEndpoint(incorrectSchemeUri)); @@ -222,18 +222,18 @@ public void ValidateOptionsWithRelativeUriEndpoint() var relativeUri = new Uri("/abc/cde", UriKind.Relative); var deliveryOptionsSteps = DeliveryOptionsBuilder .CreateInstance() - .WithProjectId(_guid) + .WithEnvironmentId(_guid) .UseProductionApi(); Assert.Throws(() => deliveryOptionsSteps.WithCustomEndpoint(relativeUri)); } [Fact] - public void ValidateOptionsBuiltWithBuilderWithEmptyProjectId() + public void ValidateOptionsBuiltWithBuilderWithEmptyEnvironmentId() { var deliveryOptionsSteps = DeliveryOptionsBuilder.CreateInstance(); - Assert.Throws(() => deliveryOptionsSteps.WithProjectId(Guid.Empty)); + Assert.Throws(() => deliveryOptionsSteps.WithEnvironmentId(Guid.Empty)); } } } diff --git a/Kontent.Ai.Delivery.Tests/Builders/DeliveryClient/DeliveryClientBuilderTests.cs b/Kontent.Ai.Delivery.Tests/Builders/DeliveryClient/DeliveryClientBuilderTests.cs index db8225a8..7a8a782d 100644 --- a/Kontent.Ai.Delivery.Tests/Builders/DeliveryClient/DeliveryClientBuilderTests.cs +++ b/Kontent.Ai.Delivery.Tests/Builders/DeliveryClient/DeliveryClientBuilderTests.cs @@ -16,36 +16,36 @@ namespace Kontent.Ai.Delivery.Tests.Builders.DeliveryClient { public class DeliveryClientBuilderTests { - private const string ProjectId = "e5629811-ddaa-4c2b-80d2-fa91e16bb264"; + private const string EnvironmentId = "e5629811-ddaa-4c2b-80d2-fa91e16bb264"; private const string PreviewEndpoint = "https://preview-deliver.test.com/{0}"; private const string PreviewApiKey = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJqdGkiOiI3YjJlM2FiOTBjOGM0ODVmYjdmZTczNWY0ZGM1NDIyMCIsImlhdCI6IjE1Mjg4ODc2MzQiLCJleHAiOiIxODc0NDg3NjM0IiwicHJvamVjd" + "F9pZCI6IjEyMzQ1Njc5OGFiY2RibGFibGEiLCJ2ZXIiOiIxLjAuMCIsImF1ZCI6InByZXZpZXcuZGVsaXZlci5rZW50aWNvY2xvdWQuY29tIn0.wtSzbNDpbEHR2Bj4LUTGsdgesg4b693TFuhRCRsDyoc"; - private readonly Guid _guid = new Guid(ProjectId); + private readonly Guid _guid = new Guid(EnvironmentId); [Fact] - public void BuildWithProjectId_ReturnsDeliveryClientWithProjectIdSet() + public void BuildWithEnvironmentId_ReturnsDeliveryClientWithEnvironmentIdSet() { - var deliveryClient = (Delivery.DeliveryClient) DeliveryClientBuilder.WithProjectId(ProjectId).Build(); + var deliveryClient = (Delivery.DeliveryClient) DeliveryClientBuilder.WithEnvironmentId(EnvironmentId).Build(); - Assert.Equal(ProjectId, deliveryClient.DeliveryOptions.CurrentValue.ProjectId); + Assert.Equal(EnvironmentId, deliveryClient.DeliveryOptions.CurrentValue.EnvironmentId); } [Fact] public void BuildWithDeliveryOptions_ReturnsDeliveryClientWithDeliveryOptions() { - var guid = new Guid(ProjectId); + var guid = new Guid(EnvironmentId); var deliveryClient = (Delivery.DeliveryClient) DeliveryClientBuilder .WithOptions(builder => builder - .WithProjectId(guid) + .WithEnvironmentId(guid) .UsePreviewApi(PreviewApiKey) .WithCustomEndpoint(PreviewEndpoint) .Build() ).Build(); - Assert.Equal(ProjectId, deliveryClient.DeliveryOptions.CurrentValue.ProjectId); + Assert.Equal(EnvironmentId, deliveryClient.DeliveryOptions.CurrentValue.EnvironmentId); Assert.True(deliveryClient.DeliveryOptions.CurrentValue.UsePreviewApi); Assert.Equal(PreviewEndpoint, deliveryClient.DeliveryOptions.CurrentValue.PreviewEndpoint); } @@ -66,7 +66,7 @@ public void BuildWithOptionalSteps_ReturnsDeliveryClientWithSetInstances() var mockLoggerFactory = A.Fake(); var deliveryClient = (Delivery.DeliveryClient) DeliveryClientBuilder - .WithProjectId(ProjectId) + .WithEnvironmentId(EnvironmentId) .WithDeliveryHttpClient(mockDeliveryHttpClient) .WithContentLinkUrlResolver(mockContentLinkUrlResolver) .WithInlineContentItemsProcessor(mockInlineContentItemsProcessor) @@ -80,7 +80,7 @@ public void BuildWithOptionalSteps_ReturnsDeliveryClientWithSetInstances() .WithLoggerFactory(mockLoggerFactory) .Build(); - Assert.Equal(ProjectId, deliveryClient.DeliveryOptions.CurrentValue.ProjectId); + Assert.Equal(EnvironmentId, deliveryClient.DeliveryOptions.CurrentValue.EnvironmentId); Assert.Equal(mockModelProvider, deliveryClient.ModelProvider); Assert.Equal(mockRetryPolicyProvider, deliveryClient.RetryPolicyProvider); Assert.Equal(mockTypeProvider, deliveryClient.TypeProvider); @@ -103,14 +103,14 @@ public void BuildWithOptionalStepsWithCustomResolvers_ReturnsDeliveryClientWithS }; var deliveryClient = (Delivery.DeliveryClient)DeliveryClientBuilder - .WithProjectId(ProjectId) + .WithEnvironmentId(EnvironmentId) .WithInlineContentItemsResolver(mockDefaultInlineContentItemsResolver) .WithInlineContentItemsResolver(mockUnretrievedInlineContentItemsResolver) .WithInlineContentItemsResolver(mockCompleteContentItemsResolver) .Build(); var actualResolvableInlineContentItemTypes = GetResolvableInlineContentItemTypes(deliveryClient); - Assert.Equal(ProjectId, deliveryClient.DeliveryOptions.CurrentValue.ProjectId); + Assert.Equal(EnvironmentId, deliveryClient.DeliveryOptions.CurrentValue.EnvironmentId); Assert.Equal(expectedResolvableInlineContentItemsTypes, actualResolvableInlineContentItemTypes); } @@ -120,7 +120,7 @@ public void BuildWithOptionalStepsAndCustomProvider_ReturnsDeliveryClientWithSet var modelProvider = new FakeModelProvider(); var deliveryClient = (Delivery.DeliveryClient) DeliveryClientBuilder - .WithProjectId(ProjectId) + .WithEnvironmentId(EnvironmentId) .WithModelProvider(modelProvider) .Build(); @@ -138,7 +138,7 @@ public void BuildWithoutOptionalSteps_ReturnsDeliveryClientWithDefaultImplementa }; var deliveryClient = (Delivery.DeliveryClient) DeliveryClientBuilder - .WithProjectId(_guid) + .WithEnvironmentId(_guid) .Build(); var actualResolvableInlineContentItemTypes = GetResolvableInlineContentItemTypes(deliveryClient); @@ -153,7 +153,7 @@ public void BuildWithoutOptionalSteps_ReturnsDeliveryClientWithDefaultImplementa [Fact] public void BuildWithOptionsAndNullHttpClient_ThrowsArgumentNullException() { - var builderStep = DeliveryClientBuilder.WithProjectId(_guid); + var builderStep = DeliveryClientBuilder.WithEnvironmentId(_guid); Assert.Throws(() => builderStep.WithDeliveryHttpClient(null)); } @@ -161,7 +161,7 @@ public void BuildWithOptionsAndNullHttpClient_ThrowsArgumentNullException() [Fact] public void BuildWithOptionsAndNullContentLinUrlResolver_ThrowsArgumentNullException() { - var builderStep = DeliveryClientBuilder.WithProjectId(_guid); + var builderStep = DeliveryClientBuilder.WithEnvironmentId(_guid); Assert.Throws(() => builderStep.WithContentLinkUrlResolver(null)); } @@ -169,7 +169,7 @@ public void BuildWithOptionsAndNullContentLinUrlResolver_ThrowsArgumentNullExcep [Fact] public void BuildWithOptionsAndNullModelProvider_ThrowsArgumentNullException() { - var builderStep = DeliveryClientBuilder.WithProjectId(_guid); + var builderStep = DeliveryClientBuilder.WithEnvironmentId(_guid); Assert.Throws(() => builderStep.WithModelProvider(null)); } @@ -177,7 +177,7 @@ public void BuildWithOptionsAndNullModelProvider_ThrowsArgumentNullException() [Fact] public void BuildWithOptionsAndNullInlineContentItemsResolver_ThrowsArgumentNullException() { - var builderStep = DeliveryClientBuilder.WithProjectId(_guid); + var builderStep = DeliveryClientBuilder.WithEnvironmentId(_guid); Assert.Throws(() => builderStep.WithInlineContentItemsResolver(null)); } @@ -185,7 +185,7 @@ public void BuildWithOptionsAndNullInlineContentItemsResolver_ThrowsArgumentNull [Fact] public void BuildWithOptionsAndNullInlineContentItemsProcessor_ThrowsArgumentNullException() { - var builderStep = DeliveryClientBuilder.WithProjectId(_guid); + var builderStep = DeliveryClientBuilder.WithEnvironmentId(_guid); Assert.Throws(() => builderStep.WithInlineContentItemsProcessor(null)); } @@ -193,7 +193,7 @@ public void BuildWithOptionsAndNullInlineContentItemsProcessor_ThrowsArgumentNul [Fact] public void BuildWithOptionsAndNullTypeProvider_ThrowsArgumentNullException() { - var builderStep = DeliveryClientBuilder.WithProjectId(_guid); + var builderStep = DeliveryClientBuilder.WithEnvironmentId(_guid); Assert.Throws(() => builderStep.WithTypeProvider(null)); } @@ -201,7 +201,7 @@ public void BuildWithOptionsAndNullTypeProvider_ThrowsArgumentNullException() [Fact] public void BuildWithOptionsAndNullResiliencePolicyProvider_ThrowsArgumentNullException() { - var builderStep = DeliveryClientBuilder.WithProjectId(_guid); + var builderStep = DeliveryClientBuilder.WithEnvironmentId(_guid); Assert.Throws(() => builderStep.WithRetryPolicyProvider(null)); } @@ -209,7 +209,7 @@ public void BuildWithOptionsAndNullResiliencePolicyProvider_ThrowsArgumentNullEx [Fact] public void BuildWithOptionsAndNullPropertyMapper_ThrowsArgumentNullException() { - var builderStep = DeliveryClientBuilder.WithProjectId(_guid); + var builderStep = DeliveryClientBuilder.WithEnvironmentId(_guid); Assert.Throws(() => builderStep.WithPropertyMapper(null)); } @@ -217,7 +217,7 @@ public void BuildWithOptionsAndNullPropertyMapper_ThrowsArgumentNullException() [Fact] public void BuildWithOptionsAndNullLoggerFactory_TrowsArgumentNullException() { - var builderStep = DeliveryClientBuilder.WithProjectId(_guid); + var builderStep = DeliveryClientBuilder.WithEnvironmentId(_guid); Assert.Throws(() => builderStep.WithLoggerFactory(null)); } diff --git a/Kontent.Ai.Delivery.Tests/ContentLinkResolverTests.cs b/Kontent.Ai.Delivery.Tests/ContentLinkResolverTests.cs index 2bf24b8f..d32c71fa 100644 --- a/Kontent.Ai.Delivery.Tests/ContentLinkResolverTests.cs +++ b/Kontent.Ai.Delivery.Tests/ContentLinkResolverTests.cs @@ -128,8 +128,8 @@ public async void ResolveLinksInStronglyTypedModel() mockHttp.When(url). Respond("application/json", await File.ReadAllTextAsync(Path.Combine(Environment.CurrentDirectory, $"Fixtures{Path.DirectorySeparatorChar}ContentLinkResolver{Path.DirectorySeparatorChar}coffee_processing_techniques.json"))); - var deliveryOptions = DeliveryOptionsFactory.CreateMonitor(new DeliveryOptions { ProjectId = guid }); - var options = DeliveryOptionsFactory.Create(new DeliveryOptions { ProjectId = guid }); + var deliveryOptions = DeliveryOptionsFactory.CreateMonitor(new DeliveryOptions { EnvironmentId = guid }); + var options = DeliveryOptionsFactory.Create(new DeliveryOptions { EnvironmentId = guid }); var deliveryHttpClient = new DeliveryHttpClient(mockHttp.ToHttpClient()); var resiliencePolicyProvider = new DefaultRetryPolicyProvider(options); var contentLinkUrlResolver = new CustomContentLinkUrlResolver(); diff --git a/Kontent.Ai.Delivery.Tests/DeliveryClientTests.cs b/Kontent.Ai.Delivery.Tests/DeliveryClientTests.cs index 3e972c34..7ed77e24 100644 --- a/Kontent.Ai.Delivery.Tests/DeliveryClientTests.cs +++ b/Kontent.Ai.Delivery.Tests/DeliveryClientTests.cs @@ -35,8 +35,8 @@ public class DeliveryClientTests public DeliveryClientTests() { _guid = Guid.NewGuid(); - var projectId = _guid.ToString(); - _baseUrl = $"https://deliver.kontent.ai/{projectId}"; + var environmentId = _guid.ToString(); + _baseUrl = $"https://deliver.kontent.ai/{environmentId}"; _mockHttp = new MockHttpMessageHandler(); _mockTypeProvider = A.Fake(); _mockContentLinkUrlResolver = A.Fake(); @@ -199,9 +199,9 @@ public async Task GetItemAsync_NotFound_RespondsWithApiError() } [Fact] - public async Task GetItemAsync_InvalidProjectId_RespondsWithApiError() + public async Task GetItemAsync_InvalidEnvironmentId_RespondsWithApiError() { - var expectedError = CreateInvalidProjectIdApiError(); + var expectedError = CreateInvalidEnvironmentIdApiError(); var response = CreateApiErrorResponse(expectedError); _mockHttp @@ -293,9 +293,9 @@ public async Task GetItemsAsync() } [Fact] - public async Task GetItemsAsync_InvalidProjectId_RespondsWithApiError() + public async Task GetItemsAsync_InvalidEnvironmentId_RespondsWithApiError() { - var expectedError = CreateInvalidProjectIdApiError(); + var expectedError = CreateInvalidEnvironmentIdApiError(); var response = CreateApiErrorResponse(expectedError); _mockHttp @@ -418,9 +418,9 @@ public async Task GetItemsFeed_MultipleBatches_FetchNextBatchAsync() } [Fact] - public async Task GetItemsFeed_InvalidProjectId_RespondsWithApiError() + public async Task GetItemsFeed_InvalidEnvironmentId_RespondsWithApiError() { - var expectedError = CreateInvalidProjectIdApiError(); + var expectedError = CreateInvalidEnvironmentIdApiError(); var response = CreateApiErrorResponse(expectedError); _mockHttp @@ -506,9 +506,9 @@ public async Task GetTypeAsync_NotFound_RespondsWithApiError() } [Fact] - public async Task GetTypeAsync_InvalidProjectId_RespondsWithApiError() + public async Task GetTypeAsync_InvalidEnvironmentId_RespondsWithApiError() { - var expectedError = CreateInvalidProjectIdApiError(); + var expectedError = CreateInvalidEnvironmentIdApiError(); var response = CreateApiErrorResponse(expectedError); _mockHttp @@ -695,9 +695,9 @@ public async Task GetTaxonomiesAsync() } [Fact] - public async Task GetTaxonomiesAsync_InvalidProjectId_RespondsWithApiError() + public async Task GetTaxonomiesAsync_InvalidEnvironmentId_RespondsWithApiError() { - var expectedError = CreateInvalidProjectIdApiError(); + var expectedError = CreateInvalidEnvironmentIdApiError(); var response = CreateApiErrorResponse(expectedError); _mockHttp @@ -1114,7 +1114,7 @@ public async Task LongUrl() .When($"{_baseUrl}/items") .Respond("application/json", await File.ReadAllTextAsync(Path.Combine(Environment.CurrentDirectory, $"Fixtures{Path.DirectorySeparatorChar}DeliveryClient{Path.DirectorySeparatorChar}items.json"))); - var client = Factories.DeliveryClientFactory.GetMockedDeliveryClientWithProjectId(_guid, _mockHttp); + var client = Factories.DeliveryClientFactory.GetMockedDeliveryClientWithEnvironmentId(_guid, _mockHttp); var retryPolicy = A.Fake(); A.CallTo(() => client.RetryPolicyProvider.GetRetryPolicy()) .Returns(retryPolicy); @@ -1140,7 +1140,7 @@ public async Task TooLongUrlThrows() .When($"{_baseUrl}/items") .Respond("application/json", await File.ReadAllTextAsync(Path.Combine(Environment.CurrentDirectory, $"Fixtures{Path.DirectorySeparatorChar}DeliveryClient{Path.DirectorySeparatorChar}items.json"))); - var client = Factories.DeliveryClientFactory.GetMockedDeliveryClientWithProjectId(_guid, _mockHttp); + var client = Factories.DeliveryClientFactory.GetMockedDeliveryClientWithEnvironmentId(_guid, _mockHttp); var elements = new ElementsParameter(Enumerable.Range(0, 1000000).Select(i => "test").ToArray()); @@ -1171,7 +1171,7 @@ public async Task PreviewAndSecuredProductionThrowsWhenBothEnabled(bool usePrevi var options = new DeliveryOptions { - ProjectId = _guid.ToString(), + EnvironmentId = _guid.ToString(), UsePreviewApi = usePreviewApi, UseSecureAccess = useSecuredProduction, PreviewApiKey = "someKey", @@ -1206,7 +1206,7 @@ public async Task SecuredProductionAddCorrectHeader() var securityKey = "someKey"; var options = new DeliveryOptions { - ProjectId = _guid.ToString(), + EnvironmentId = _guid.ToString(), SecureAccessApiKey = securityKey, UseSecureAccess = true }; @@ -1480,9 +1480,9 @@ public async Task GetTypesAsync_ApiDoesNotReturnStaleContent_ResponseDoesNotIndi } [Fact] - public async Task GetTypesAsync_InvalidProjectId_RespondsWithApiError() + public async Task GetTypesAsync_InvalidEnvironmentId_RespondsWithApiError() { - var expectedError = CreateInvalidProjectIdApiError(); + var expectedError = CreateInvalidEnvironmentIdApiError(); var response = CreateApiErrorResponse(expectedError); _mockHttp @@ -1625,9 +1625,9 @@ public async Task GetLanguagesAsync_ApiDoesNotReturnStaleContent_ResponseDoesNot } [Fact] - public async Task GetLanguagesAsync_InvalidProjectId_RespondsWithApiError() + public async Task GetLanguagesAsync_InvalidEnvironmentId_RespondsWithApiError() { - var expectedError = CreateInvalidProjectIdApiError(); + var expectedError = CreateInvalidEnvironmentIdApiError(); var response = CreateApiErrorResponse(expectedError); _mockHttp @@ -1684,9 +1684,9 @@ public async Task GetElementAsync_ApiDoesNotReturnStaleContent_ResponseDoesNotIn } [Fact] - public async Task GetElementAsync_InvalidProjectId_RespondsWithApiError() + public async Task GetElementAsync_InvalidEnvironmentId_RespondsWithApiError() { - var expectedError = CreateInvalidProjectIdApiError(); + var expectedError = CreateInvalidEnvironmentIdApiError(); var response = CreateApiErrorResponse(expectedError); _mockHttp @@ -1707,7 +1707,7 @@ public async Task RetryPolicy_WithDefaultOptions_Retries() _mockHttp .When($"{_baseUrl}/items") .Respond(request => new HttpResponseMessage(HttpStatusCode.RequestTimeout)); - var client = Factories.DeliveryClientFactory.GetMockedDeliveryClientWithProjectId(_guid, _mockHttp); + var client = Factories.DeliveryClientFactory.GetMockedDeliveryClientWithEnvironmentId(_guid, _mockHttp); var retryPolicy = A.Fake(); A.CallTo(() => client.RetryPolicyProvider.GetRetryPolicy()).Returns(retryPolicy); A.CallTo(() => retryPolicy.ExecuteAsync(A>>._)) @@ -1726,7 +1726,7 @@ public async Task RetryPolicy_Disabled_DoesNotRetry() .Respond(request => new HttpResponseMessage(HttpStatusCode.RequestTimeout)); var options = new DeliveryOptions { - ProjectId = _guid.ToString(), + EnvironmentId = _guid.ToString(), EnableRetryPolicy = false }; var client = Factories.DeliveryClientFactory.GetMockedDeliveryClientWithOptions(options, _mockHttp); @@ -1750,7 +1750,7 @@ public async Task InitializeMultipleInlineContentItemsResolvers() .Respond("application/json", await File.ReadAllTextAsync(Path.Combine(Environment.CurrentDirectory, $"Fixtures{Path.DirectorySeparatorChar}DeliveryClient{Path.DirectorySeparatorChar}coffee_beverages_explained.json"))); var deliveryClient = DeliveryClientBuilder - .WithProjectId(_guid) + .WithEnvironmentId(_guid) .WithInlineContentItemsResolver(InlineContentItemsResolverFactory.Instance .ResolveTo(tweet => tweetPrefix + tweet.TweetLink)) .WithInlineContentItemsResolver(InlineContentItemsResolverFactory.Instance @@ -1942,7 +1942,7 @@ private DeliveryClient InitializeDeliveryClientWithACustomTypeProvider(MockHttpM new DeliveryJsonSerializer(), new HtmlParser(), DeliveryOptionsFactory.CreateMonitor(_guid)); - var client = Factories.DeliveryClientFactory.GetMockedDeliveryClientWithProjectId( + var client = Factories.DeliveryClientFactory.GetMockedDeliveryClientWithEnvironmentId( _guid, handler, modelProvider, @@ -1963,7 +1963,7 @@ private DeliveryClient InitializeDeliveryClientWithCustomModelProvider(MockHttpM var mapper = propertyMapper ?? A.Fake(); var serializer = new DeliveryJsonSerializer(); var modelProvider = new ModelProvider(null, null, typer, mapper, serializer, new HtmlParser(), DeliveryOptionsFactory.CreateMonitor(_guid)); - var client = Factories.DeliveryClientFactory.GetMockedDeliveryClientWithProjectId(_guid, handler, modelProvider); + var client = Factories.DeliveryClientFactory.GetMockedDeliveryClientWithEnvironmentId(_guid, handler, modelProvider); var retryPolicy = A.Fake(); A.CallTo(() => client.RetryPolicyProvider.GetRetryPolicy()) @@ -1974,12 +1974,12 @@ private DeliveryClient InitializeDeliveryClientWithCustomModelProvider(MockHttpM return client; } - private Error CreateInvalidProjectIdApiError() => new Error() + private Error CreateInvalidEnvironmentIdApiError() => new Error() { ErrorCode = 105, RequestId = "", SpecificCode = 0, - Message = $"Project with the ID '{_guid.ToString()}' does not exist. Check for the correct project ID in the API keys section of the UI. See https://kontent.ai/learn/reference/delivery-api for more details." + Message = $"Environment with the ID '{_guid.ToString()}' does not exist. Check for the correct environment ID in the API keys section of the UI. See https://kontent.ai/learn/reference/delivery-api for more details." }; private static string CreateApiErrorResponse(Error error) diff --git a/Kontent.Ai.Delivery.Tests/DependencyInjectionFrameworks/DeliveryClientAssertionExtensions.cs b/Kontent.Ai.Delivery.Tests/DependencyInjectionFrameworks/DeliveryClientAssertionExtensions.cs index ba1380fc..3e605867 100644 --- a/Kontent.Ai.Delivery.Tests/DependencyInjectionFrameworks/DeliveryClientAssertionExtensions.cs +++ b/Kontent.Ai.Delivery.Tests/DependencyInjectionFrameworks/DeliveryClientAssertionExtensions.cs @@ -11,7 +11,7 @@ namespace Kontent.Ai.Delivery.Tests.DependencyInjectionFrameworks { internal static class DeliveryClientAssertionExtensions { - private const string ProjectId = "00a21be4-8fef-4dd9-9380-f4cbb82e260d"; + private const string EnvironmentId = "00a21be4-8fef-4dd9-9380-f4cbb82e260d"; internal static void AssertDefaultDependencies(this DeliveryClient client) { @@ -31,7 +31,7 @@ private static void AssertDefaultDependenciesWithCustomModelProvider(client); - Assert.Equal(ProjectId, client.DeliveryOptions.CurrentValue.ProjectId); + Assert.Equal(EnvironmentId, client.DeliveryOptions.CurrentValue.EnvironmentId); Assert.IsType(client.TypeProvider); Assert.IsType(client.RetryPolicyProvider); Assert.IsType(client.DeliveryOptions.CurrentValue); diff --git a/Kontent.Ai.Delivery.Tests/DependencyInjectionFrameworks/Helpers/DependencyInjectionFrameworksHelper.cs b/Kontent.Ai.Delivery.Tests/DependencyInjectionFrameworks/Helpers/DependencyInjectionFrameworksHelper.cs index ec33b3af..9b593f54 100644 --- a/Kontent.Ai.Delivery.Tests/DependencyInjectionFrameworks/Helpers/DependencyInjectionFrameworksHelper.cs +++ b/Kontent.Ai.Delivery.Tests/DependencyInjectionFrameworks/Helpers/DependencyInjectionFrameworksHelper.cs @@ -17,11 +17,11 @@ namespace Kontent.Ai.Delivery.Tests.DependencyInjectionFrameworks.Helpers { internal static class DependencyInjectionFrameworksHelper { - private const string ProjectId = "00a21be4-8fef-4dd9-9380-f4cbb82e260d"; + private const string EnvironmentId = "00a21be4-8fef-4dd9-9380-f4cbb82e260d"; internal static IServiceCollection GetServiceCollection() => new ServiceCollection() - .AddDeliveryClient(new DeliveryOptions { ProjectId = ProjectId }); + .AddDeliveryClient(new DeliveryOptions { EnvironmentId = EnvironmentId }); internal static IServiceCollection RegisterInlineContentItemResolvers(this IServiceCollection serviceCollection) => serviceCollection diff --git a/Kontent.Ai.Delivery.Tests/Extensions/ServiceCollectionsExtensionsTests.cs b/Kontent.Ai.Delivery.Tests/Extensions/ServiceCollectionsExtensionsTests.cs index e27ffc7e..401c3efb 100644 --- a/Kontent.Ai.Delivery.Tests/Extensions/ServiceCollectionsExtensionsTests.cs +++ b/Kontent.Ai.Delivery.Tests/Extensions/ServiceCollectionsExtensionsTests.cs @@ -17,7 +17,7 @@ namespace Kontent.Ai.Delivery.Tests.Extensions public class ServiceCollectionsExtensionsTests { private readonly ServiceCollection _serviceCollection; - private const string ProjectId = "d79786fb-042c-47ec-8e5c-beaf93e38b84"; + private const string EnvironmentId = "d79786fb-042c-47ec-8e5c-beaf93e38b84"; private readonly ReadOnlyDictionary _expectedInterfacesWithImplementationTypes = new ReadOnlyDictionary( new Dictionary @@ -66,7 +66,7 @@ public void AddDeliveryClientWithNullBuildDeliveryOptions_ThrowsArgumentNullExce [Fact] public void AddDeliveryClientWithOptions_AllServicesAreRegistered() { - _serviceCollection.AddDeliveryClient(new DeliveryOptions { ProjectId = ProjectId }); + _serviceCollection.AddDeliveryClient(new DeliveryOptions { EnvironmentId = EnvironmentId }); var provider = _serviceCollection.BuildServiceProvider(); AssertDefaultServiceCollection(provider, _expectedInterfacesWithImplementationTypes); } diff --git a/Kontent.Ai.Delivery.Tests/Factories/DeliveryClientFactory.cs b/Kontent.Ai.Delivery.Tests/Factories/DeliveryClientFactory.cs index f5df9d37..f70015dc 100644 --- a/Kontent.Ai.Delivery.Tests/Factories/DeliveryClientFactory.cs +++ b/Kontent.Ai.Delivery.Tests/Factories/DeliveryClientFactory.cs @@ -11,8 +11,8 @@ internal static class DeliveryClientFactory private static readonly MockHttpMessageHandler MockHttp = new MockHttpMessageHandler(); private static readonly DeliveryJsonSerializer Serializer = new DeliveryJsonSerializer(); - internal static DeliveryClient GetMockedDeliveryClientWithProjectId( - Guid projectId, + internal static DeliveryClient GetMockedDeliveryClientWithEnvironmentId( + Guid environmentId, MockHttpMessageHandler httpMessageHandler = null, IModelProvider modelProvider = null, IRetryPolicyProvider resiliencePolicyProvider = null, @@ -21,7 +21,7 @@ internal static DeliveryClient GetMockedDeliveryClientWithProjectId( var httpClient = GetHttpClient(httpMessageHandler); var client = new DeliveryClient( - DeliveryOptionsFactory.CreateMonitor(projectId), + DeliveryOptionsFactory.CreateMonitor(environmentId), modelProvider ?? A.Fake(), resiliencePolicyProvider ?? A.Fake(), typeProvider ?? A.Fake(), diff --git a/Kontent.Ai.Delivery.Tests/Factories/DeliveryClientFactoryTests.cs b/Kontent.Ai.Delivery.Tests/Factories/DeliveryClientFactoryTests.cs index e224ee43..5e327b21 100644 --- a/Kontent.Ai.Delivery.Tests/Factories/DeliveryClientFactoryTests.cs +++ b/Kontent.Ai.Delivery.Tests/Factories/DeliveryClientFactoryTests.cs @@ -30,7 +30,7 @@ public void GetClient_GetClient() { _serviceCollection.AddDeliveryClient(new DeliveryOptions { - ProjectId = Guid.NewGuid().ToString() + EnvironmentId = Guid.NewGuid().ToString() }); var deliveryClientFactory = new Delivery.DeliveryClientFactory(_serviceCollection.BuildServiceProvider()); diff --git a/Kontent.Ai.Delivery.Tests/Factories/DeliveryOptionsFactory.cs b/Kontent.Ai.Delivery.Tests/Factories/DeliveryOptionsFactory.cs index 54e1903b..09b47e2a 100644 --- a/Kontent.Ai.Delivery.Tests/Factories/DeliveryOptionsFactory.cs +++ b/Kontent.Ai.Delivery.Tests/Factories/DeliveryOptionsFactory.cs @@ -14,9 +14,9 @@ public static IOptionsMonitor CreateMonitor(DeliveryOptions opt return mock; } - public static IOptionsMonitor CreateMonitor(Guid projectId) + public static IOptionsMonitor CreateMonitor(Guid environmentId) { - return CreateMonitor(new DeliveryOptions { ProjectId = projectId.ToString() }); + return CreateMonitor(new DeliveryOptions { EnvironmentId = environmentId.ToString() }); } public static IOptions Create(DeliveryOptions options) diff --git a/Kontent.Ai.Delivery.Tests/FakeHttpClientTests.cs b/Kontent.Ai.Delivery.Tests/FakeHttpClientTests.cs index 123c0e37..580f2aca 100644 --- a/Kontent.Ai.Delivery.Tests/FakeHttpClientTests.cs +++ b/Kontent.Ai.Delivery.Tests/FakeHttpClientTests.cs @@ -47,7 +47,7 @@ private static HttpClient MockHttpClient(string baseUrl) private static DeliveryOptions MockDeliveryOptions(string baseUrl) => DeliveryOptionsBuilder .CreateInstance() - .WithProjectId(Guid.NewGuid()) + .WithEnvironmentId(Guid.NewGuid()) .UseProductionApi() .WithCustomEndpoint($"{baseUrl}/{{0}}") .Build(); diff --git a/Kontent.Ai.Delivery.Tests/Fixtures/DeliveryClient/languages.json b/Kontent.Ai.Delivery.Tests/Fixtures/DeliveryClient/languages.json index ace3db0a..b311ff7d 100644 --- a/Kontent.Ai.Delivery.Tests/Fixtures/DeliveryClient/languages.json +++ b/Kontent.Ai.Delivery.Tests/Fixtures/DeliveryClient/languages.json @@ -3,7 +3,7 @@ { "system": { "id": "00000000-0000-0000-0000-000000000000", - "name": "Default project language", + "name": "Default environment language", "codename": "default" } }, diff --git a/Kontent.Ai.Delivery.Tests/Fixtures/ServiceCollectionsExtensions/deliveryOptions_as_root.json b/Kontent.Ai.Delivery.Tests/Fixtures/ServiceCollectionsExtensions/deliveryOptions_as_root.json index c7644b8f..e5931b45 100644 --- a/Kontent.Ai.Delivery.Tests/Fixtures/ServiceCollectionsExtensions/deliveryOptions_as_root.json +++ b/Kontent.Ai.Delivery.Tests/Fixtures/ServiceCollectionsExtensions/deliveryOptions_as_root.json @@ -1,3 +1,3 @@ { - "ProjectId": "d79786fb-042c-47ec-8e5c-beaf93e38b84" + "EnvironmentId": "d79786fb-042c-47ec-8e5c-beaf93e38b84" } diff --git a/Kontent.Ai.Delivery.Tests/Fixtures/ServiceCollectionsExtensions/deliveryOptions_nested_under_default_key.json b/Kontent.Ai.Delivery.Tests/Fixtures/ServiceCollectionsExtensions/deliveryOptions_nested_under_default_key.json index e0af26fc..67d5a479 100644 --- a/Kontent.Ai.Delivery.Tests/Fixtures/ServiceCollectionsExtensions/deliveryOptions_nested_under_default_key.json +++ b/Kontent.Ai.Delivery.Tests/Fixtures/ServiceCollectionsExtensions/deliveryOptions_nested_under_default_key.json @@ -1,7 +1,7 @@ { "Options": { "DeliveryOptions": { - "ProjectId": "d79786fb-042c-47ec-8e5c-beaf93e38b84" + "EnvironmentId": "d79786fb-042c-47ec-8e5c-beaf93e38b84" } } } diff --git a/Kontent.Ai.Delivery.Tests/Fixtures/ServiceCollectionsExtensions/deliveryOptions_under_custom_key.json b/Kontent.Ai.Delivery.Tests/Fixtures/ServiceCollectionsExtensions/deliveryOptions_under_custom_key.json index 04944c7d..d4f05e28 100644 --- a/Kontent.Ai.Delivery.Tests/Fixtures/ServiceCollectionsExtensions/deliveryOptions_under_custom_key.json +++ b/Kontent.Ai.Delivery.Tests/Fixtures/ServiceCollectionsExtensions/deliveryOptions_under_custom_key.json @@ -1,5 +1,5 @@ { "CustomNameForDeliveryOptions": { - "ProjectId": "d79786fb-042c-47ec-8e5c-beaf93e38b84" + "EnvironmentId": "d79786fb-042c-47ec-8e5c-beaf93e38b84" } } diff --git a/Kontent.Ai.Delivery.Tests/Fixtures/ServiceCollectionsExtensions/deliveryOptions_under_default_key.json b/Kontent.Ai.Delivery.Tests/Fixtures/ServiceCollectionsExtensions/deliveryOptions_under_default_key.json index cb8545b8..cd8614d6 100644 --- a/Kontent.Ai.Delivery.Tests/Fixtures/ServiceCollectionsExtensions/deliveryOptions_under_default_key.json +++ b/Kontent.Ai.Delivery.Tests/Fixtures/ServiceCollectionsExtensions/deliveryOptions_under_default_key.json @@ -1,5 +1,5 @@ { "DeliveryOptions": { - "ProjectId": "d79786fb-042c-47ec-8e5c-beaf93e38b84" + "EnvironmentId": "d79786fb-042c-47ec-8e5c-beaf93e38b84" } } diff --git a/Kontent.Ai.Delivery.Tests/Kontent.Ai.Delivery.Tests.csproj b/Kontent.Ai.Delivery.Tests/Kontent.Ai.Delivery.Tests.csproj index 397bea67..2f61ad19 100644 --- a/Kontent.Ai.Delivery.Tests/Kontent.Ai.Delivery.Tests.csproj +++ b/Kontent.Ai.Delivery.Tests/Kontent.Ai.Delivery.Tests.csproj @@ -1,7 +1,7 @@  - net6.0 + net8.0 false false false diff --git a/Kontent.Ai.Delivery.Tests/QueryParameters/ContentTypeExtractorTests.cs b/Kontent.Ai.Delivery.Tests/QueryParameters/ContentTypeExtractorTests.cs index 948af2f0..de80dea0 100644 --- a/Kontent.Ai.Delivery.Tests/QueryParameters/ContentTypeExtractorTests.cs +++ b/Kontent.Ai.Delivery.Tests/QueryParameters/ContentTypeExtractorTests.cs @@ -13,7 +13,7 @@ namespace Kontent.Ai.Delivery.Tests.QueryParameters public class ContentTypeExtractorTests { private const string CONTENT_TYPE_CODENAME = "SomeContentType"; - private const string FAKE_PROJECT_ID = "00000000-0000-0000-0000-000000000000"; + private const string FAKE_ENVIRONMENT_ID = "00000000-0000-0000-0000-000000000000"; private readonly DeliveryClient _client; @@ -24,7 +24,7 @@ public ContentTypeExtractorTests() A.CallTo(() => contentTypeProvider.GetCodename(typeof(TypeWithContentTypeCodename))).Returns(TypeWithContentTypeCodename.Codename); A.CallTo(() => contentTypeProvider.GetCodename(typeof(TypeWithoutContentTypeCodename))).Returns(null); - var deliveryOptions = DeliveryOptionsFactory.CreateMonitor(new DeliveryOptions { ProjectId = FAKE_PROJECT_ID }); + var deliveryOptions = DeliveryOptionsFactory.CreateMonitor(new DeliveryOptions { EnvironmentId = FAKE_ENVIRONMENT_ID }); var modelProvider = new ModelProvider(null, null, contentTypeProvider, null, new DeliveryJsonSerializer(), new HtmlParser(), deliveryOptions); _client = new DeliveryClient( deliveryOptions, diff --git a/Kontent.Ai.Delivery.Tests/QueryParameters/IncludeTotalCountTests.cs b/Kontent.Ai.Delivery.Tests/QueryParameters/IncludeTotalCountTests.cs index 04c60768..c12d4165 100644 --- a/Kontent.Ai.Delivery.Tests/QueryParameters/IncludeTotalCountTests.cs +++ b/Kontent.Ai.Delivery.Tests/QueryParameters/IncludeTotalCountTests.cs @@ -13,12 +13,12 @@ namespace Kontent.Ai.Delivery.Tests.QueryParameters { public class IncludeTotalCountTests { - private readonly Guid _projectId = Guid.NewGuid(); - private string BaseUrl => $"https://deliver.kontent.ai/{_projectId}"; + private readonly Guid _environmentId = Guid.NewGuid(); + private string BaseUrl => $"https://deliver.kontent.ai/{_environmentId}"; private readonly MockHttpMessageHandler _mockHttp = new MockHttpMessageHandler(); private DeliveryOptions Options => new DeliveryOptions { - ProjectId = _projectId.ToString(), + EnvironmentId = _environmentId.ToString(), EnableRetryPolicy = false, IncludeTotalCount = true }; diff --git a/Kontent.Ai.Delivery.Tests/ValueConverterTests.cs b/Kontent.Ai.Delivery.Tests/ValueConverterTests.cs index 94dd4ec6..e3f48a64 100644 --- a/Kontent.Ai.Delivery.Tests/ValueConverterTests.cs +++ b/Kontent.Ai.Delivery.Tests/ValueConverterTests.cs @@ -149,7 +149,7 @@ public async Task AssetElementValueConverter_DefaultPresetSpecifiedInConfig_Asse var defaultRenditionPreset = "default"; - var client = InitializeDeliveryClient(mockHttp, new DeliveryOptions { ProjectId = _guid, DefaultRenditionPreset = defaultRenditionPreset}); + var client = InitializeDeliveryClient(mockHttp, new DeliveryOptions { EnvironmentId = _guid, DefaultRenditionPreset = defaultRenditionPreset}); var response = await client.GetItemAsync
("coffee_beverages_explained"); var teaserImage = response.Item.TeaserImage.FirstOrDefault(); @@ -170,7 +170,7 @@ public async Task AssetElementValueConverter_MobilePresetSpecifiedInConfig_Asset var defaultRenditionPreset = "mobile"; - var client = InitializeDeliveryClient(mockHttp, new DeliveryOptions { ProjectId = _guid, DefaultRenditionPreset = defaultRenditionPreset}); + var client = InitializeDeliveryClient(mockHttp, new DeliveryOptions { EnvironmentId = _guid, DefaultRenditionPreset = defaultRenditionPreset}); var response = await client.GetItemAsync
("coffee_beverages_explained"); var teaserImage = response.Item.TeaserImage.FirstOrDefault(); @@ -184,7 +184,7 @@ private DeliveryClient InitializeDeliveryClient(MockHttpMessageHandler mockHttp, { var deliveryHttpClient = new DeliveryHttpClient(mockHttp.ToHttpClient()); var contentLinkUrlResolver = A.Fake(); - var deliveryOptions = DeliveryOptionsFactory.CreateMonitor(options ?? new DeliveryOptions { ProjectId = _guid }); + var deliveryOptions = DeliveryOptionsFactory.CreateMonitor(options ?? new DeliveryOptions { EnvironmentId = _guid }); var retryPolicy = A.Fake(); var retryPolicyProvider = A.Fake(); A.CallTo(() => retryPolicyProvider.GetRetryPolicy()).Returns(retryPolicy); diff --git a/Kontent.Ai.Delivery/Builders/DeliveryClient/DeliveryClientBuilder.cs b/Kontent.Ai.Delivery/Builders/DeliveryClient/DeliveryClientBuilder.cs index 67b46f87..2cb4dc48 100644 --- a/Kontent.Ai.Delivery/Builders/DeliveryClient/DeliveryClientBuilder.cs +++ b/Kontent.Ai.Delivery/Builders/DeliveryClient/DeliveryClientBuilder.cs @@ -12,18 +12,18 @@ public sealed class DeliveryClientBuilder private static IDeliveryClientBuilder Builder => new DeliveryClientBuilderImplementation(); /// - /// Use project identifier. + /// Use environment identifier. /// - /// The identifier of a Kontent.ai project. - public static IOptionalClientSetup WithProjectId(string projectId) - => Builder.BuildWithProjectId(projectId); + /// The identifier of a Kontent.ai environment. + public static IOptionalClientSetup WithEnvironmentId(string environmentId) + => Builder.BuildWithEnvironmentId(environmentId); /// - /// Use project identifier. + /// Use environment identifier. /// - /// The identifier of a Kontent.ai project. - public static IOptionalClientSetup WithProjectId(Guid projectId) - => Builder.BuildWithProjectId(projectId); + /// The identifier of a Kontent.ai environment. + public static IOptionalClientSetup WithEnvironmentId(Guid environmentId) + => Builder.BuildWithEnvironmentId(environmentId); /// /// Use additional configuration. diff --git a/Kontent.Ai.Delivery/Builders/DeliveryClient/DeliveryClientBuilderImplementation.cs b/Kontent.Ai.Delivery/Builders/DeliveryClient/DeliveryClientBuilderImplementation.cs index 7c579cb7..1b806ad5 100644 --- a/Kontent.Ai.Delivery/Builders/DeliveryClient/DeliveryClientBuilderImplementation.cs +++ b/Kontent.Ai.Delivery/Builders/DeliveryClient/DeliveryClientBuilderImplementation.cs @@ -20,17 +20,17 @@ public IOptionalClientSetup BuildWithDeliveryOptions(Func BuildWithDeliveryOptions(builder => builder - .WithProjectId(projectId) + .WithEnvironmentId(environmentId) .UseProductionApi() .Build()); - public IOptionalClientSetup BuildWithProjectId(Guid projectId) + public IOptionalClientSetup BuildWithEnvironmentId(Guid environmentId) => BuildWithDeliveryOptions(builder => builder - .WithProjectId(projectId) + .WithEnvironmentId(environmentId) .UseProductionApi() .Build()); diff --git a/Kontent.Ai.Delivery/Builders/DeliveryClient/IDeliveryClientBuilder.cs b/Kontent.Ai.Delivery/Builders/DeliveryClient/IDeliveryClientBuilder.cs index 1405f2d6..411f0167 100644 --- a/Kontent.Ai.Delivery/Builders/DeliveryClient/IDeliveryClientBuilder.cs +++ b/Kontent.Ai.Delivery/Builders/DeliveryClient/IDeliveryClientBuilder.cs @@ -10,11 +10,11 @@ namespace Kontent.Ai.Delivery.Builders.DeliveryClient /// public interface IDeliveryClientBuilder { - /// > - IOptionalClientSetup BuildWithProjectId(string projectId); + /// > + IOptionalClientSetup BuildWithEnvironmentId(string environmentId); - /// > - IOptionalClientSetup BuildWithProjectId(Guid projectId); + /// > + IOptionalClientSetup BuildWithEnvironmentId(Guid environmentId); /// IOptionalClientSetup BuildWithDeliveryOptions(Func buildDeliveryOptions); diff --git a/Kontent.Ai.Delivery/Builders/DeliveryClient/IMultipleDeliveryClientFactoryBuilder.cs b/Kontent.Ai.Delivery/Builders/DeliveryClient/IMultipleDeliveryClientFactoryBuilder.cs index d36701fb..beb8aa29 100644 --- a/Kontent.Ai.Delivery/Builders/DeliveryClient/IMultipleDeliveryClientFactoryBuilder.cs +++ b/Kontent.Ai.Delivery/Builders/DeliveryClient/IMultipleDeliveryClientFactoryBuilder.cs @@ -7,7 +7,7 @@ namespace Kontent.Ai.Delivery.Builders { /// /// The builder capable of providing multiple instances of delivery client with different configurations. - /// Typically used for different project clients, or for client to the preview and delivery API. + /// Typically used for different environment clients, or for client to the preview and delivery API. /// public interface IMultipleDeliveryClientFactoryBuilder { diff --git a/Kontent.Ai.Delivery/Configuration/DeliveryOptionsBuilder.cs b/Kontent.Ai.Delivery/Configuration/DeliveryOptionsBuilder.cs index b86e4554..45749dda 100644 --- a/Kontent.Ai.Delivery/Configuration/DeliveryOptionsBuilder.cs +++ b/Kontent.Ai.Delivery/Configuration/DeliveryOptionsBuilder.cs @@ -19,18 +19,18 @@ public static IDeliveryOptionsBuilder CreateInstance() private DeliveryOptionsBuilder() { } - IDeliveryApiConfiguration IDeliveryOptionsBuilder.WithProjectId(string projectId) + IDeliveryApiConfiguration IDeliveryOptionsBuilder.WithEnvironmentId(string environmentId) { - projectId.ValidateProjectId(); - _deliveryOptions.ProjectId = projectId; + environmentId.ValidateEnvironmentId(); + _deliveryOptions.EnvironmentId = environmentId; return this; } - IDeliveryApiConfiguration IDeliveryOptionsBuilder.WithProjectId(Guid projectId) + IDeliveryApiConfiguration IDeliveryOptionsBuilder.WithEnvironmentId(Guid environmentId) { - projectId.ValidateProjectId(); - _deliveryOptions.ProjectId = projectId.ToString(); + environmentId.ValidateEnvironmentId(); + _deliveryOptions.EnvironmentId = environmentId.ToString(); return this; } diff --git a/Kontent.Ai.Delivery/Configuration/DeliveryOptionsValidator.cs b/Kontent.Ai.Delivery/Configuration/DeliveryOptionsValidator.cs index 2156da69..3c7f8681 100644 --- a/Kontent.Ai.Delivery/Configuration/DeliveryOptionsValidator.cs +++ b/Kontent.Ai.Delivery/Configuration/DeliveryOptionsValidator.cs @@ -18,37 +18,37 @@ public static class DeliveryOptionsValidator /// An instance of the class. public static void Validate(this DeliveryOptions deliveryOptions) { - ValidateProjectId(deliveryOptions.ProjectId); + ValidateEnvironmentId(deliveryOptions.EnvironmentId); ValidateUseOfPreviewAndProductionApi(deliveryOptions); ValidateKeyForEnabledApi(deliveryOptions); ValidateRetryPolicyOptions(deliveryOptions.DefaultRetryPolicyOptions); } - internal static void ValidateProjectId(this string projectId) + internal static void ValidateEnvironmentId(this string environmentId) { - if (projectId == null) + if (environmentId == null) { - throw new ArgumentNullException(nameof(projectId), "Kontent.ai project identifier is not specified."); + throw new ArgumentNullException(nameof(environmentId), "Kontent.ai environment identifier is not specified."); } - if (projectId == string.Empty) + if (environmentId == string.Empty) { - throw new ArgumentException("Kontent.ai project identifier is empty.", nameof(projectId)); + throw new ArgumentException("Kontent.ai environment identifier is empty.", nameof(environmentId)); } - if (!Guid.TryParse(projectId, out var projectIdGuid)) + if (!Guid.TryParse(environmentId, out var environmentIdGuid)) { - throw new ArgumentException("Kontent.ai project identifier '{ProjectId}' is not valid. Perhaps you have passed an API key instead?", nameof(projectId)); + throw new ArgumentException("Kontent.ai environment identifier '{EnvironmentId}' is not valid. Perhaps you have passed an API key instead?", nameof(environmentId)); } - ValidateProjectId(projectIdGuid); + ValidateEnvironmentId(environmentIdGuid); } - internal static void ValidateProjectId(this Guid projectId) + internal static void ValidateEnvironmentId(this Guid environmentId) { - if (projectId == Guid.Empty) + if (environmentId == Guid.Empty) { - throw new ArgumentException("Kontent.ai project identifier is an empty GUID.", nameof(projectId)); + throw new ArgumentException("Kontent.ai environment identifier is an empty GUID.", nameof(environmentId)); } } diff --git a/Kontent.Ai.Delivery/Configuration/IDeliveryOptionsBuilder.cs b/Kontent.Ai.Delivery/Configuration/IDeliveryOptionsBuilder.cs index 97a8c621..580b8617 100644 --- a/Kontent.Ai.Delivery/Configuration/IDeliveryOptionsBuilder.cs +++ b/Kontent.Ai.Delivery/Configuration/IDeliveryOptionsBuilder.cs @@ -11,16 +11,16 @@ namespace Kontent.Ai.Delivery.Configuration public interface IDeliveryOptionsBuilder { /// - /// Use project identifier. + /// Use environment identifier. /// - /// The identifier of a Kontent.ai project. - IDeliveryApiConfiguration WithProjectId(string projectId); + /// The identifier of a Kontent.ai environment. + IDeliveryApiConfiguration WithEnvironmentId(string environmentId); /// - /// Use project identifier. + /// Use environment identifier. /// - /// The identifier of a Kontent.ai project. - IDeliveryApiConfiguration WithProjectId(Guid projectId); + /// The identifier of a Kontent.ai environment. + IDeliveryApiConfiguration WithEnvironmentId(Guid environmentId); } /// @@ -78,7 +78,7 @@ public interface IOptionalDeliveryConfiguration : IDeliveryOptionsBuild /// /// Use a custom format for the Production or Preview API endpoint address. - /// The project identifier will be inserted at the position of the first format item "{0}". + /// The environment identifier will be inserted at the position of the first format item "{0}". /// /// /// While both HTTP and HTTPS protocols are supported, we recommend always using HTTPS. @@ -88,7 +88,7 @@ public interface IOptionalDeliveryConfiguration : IDeliveryOptionsBuild /// /// Use a custom format for the Production or Preview API endpoint address. - /// The project identifier will be inserted at the position of the first format item "{0}". + /// The environment identifier will be inserted at the position of the first format item "{0}". /// /// /// While both HTTP and HTTPS protocols are supported, we recommend always using HTTPS. diff --git a/Kontent.Ai.Delivery/DeliveryClient.cs b/Kontent.Ai.Delivery/DeliveryClient.cs index 9ee0a959..4c812c4e 100644 --- a/Kontent.Ai.Delivery/DeliveryClient.cs +++ b/Kontent.Ai.Delivery/DeliveryClient.cs @@ -43,9 +43,9 @@ internal DeliveryEndpointUrlBuilder UrlBuilder => _urlBuilder ??= new DeliveryEndpointUrlBuilder(DeliveryOptions); /// - /// Initializes a new instance of the class for retrieving content of the specified project. + /// Initializes a new instance of the class for retrieving content of the specified environment. /// - /// The settings of the Kontent.ai project. + /// The settings of the Kontent.ai environment. /// An instance of an object that can JSON responses into strongly typed CLR objects /// A provider of a retry policy. /// An instance of an object that can map Kontent.ai content types to CLR types @@ -294,7 +294,7 @@ public async Task GetTaxonomiesAsync(IEnumerab } /// - /// Returns all active languages assigned to a given project and matching the optional filtering parameters. + /// Returns all active languages assigned to a given environment and matching the optional filtering parameters. /// /// A collection of query parameters, for example, for paging. /// The instance that represents the languages. If no query parameters are specified, all languages are returned. @@ -336,7 +336,7 @@ public async Task PostSyncInitAsync(IEnumerable - /// Retrieve a list of delta updates to recently changed content items in the specified project. The types of items you get is determined by the X-Continuation token you use. + /// Retrieve a list of delta updates to recently changed content items in the specified environment. The types of items you get is determined by the X-Continuation token you use. /// /// The instance that represents the sync response that contains collection of delta updates and continuation token needed for further sync execution. public async Task GetSyncAsync(string continuationToken) diff --git a/Kontent.Ai.Delivery/Kontent.Ai.Delivery.csproj b/Kontent.Ai.Delivery/Kontent.Ai.Delivery.csproj index 0aa293f1..102ea354 100644 --- a/Kontent.Ai.Delivery/Kontent.Ai.Delivery.csproj +++ b/Kontent.Ai.Delivery/Kontent.Ai.Delivery.csproj @@ -1,7 +1,7 @@  - net6.0 + net8.0 Kontent s.r.o. Kontent s.r.o. Kontent.ai diff --git a/Kontent.Ai.Urls.Tests/DeliveryEndpointUrlBuilderTests.cs b/Kontent.Ai.Urls.Tests/DeliveryEndpointUrlBuilderTests.cs index c77faca3..a148b1b3 100644 --- a/Kontent.Ai.Urls.Tests/DeliveryEndpointUrlBuilderTests.cs +++ b/Kontent.Ai.Urls.Tests/DeliveryEndpointUrlBuilderTests.cs @@ -33,118 +33,118 @@ public IDisposable OnChange(Action listener) [Fact] public void GetItemUrl_ConstructedWithDeliveryOptionsMonitor_ReturnsItemUrl() { - var options = new DeliveryOptions() { ProjectId = Guid.NewGuid().ToString() }; + var options = new DeliveryOptions() { EnvironmentId = Guid.NewGuid().ToString() }; var optionsMonitor = new FakeOptionsMonitor(options); var deliveryEndpointUrlBuilder = new DeliveryEndpointUrlBuilder(optionsMonitor); var actualItemUrl = deliveryEndpointUrlBuilder.GetItemUrl("item_codename", new IQueryParameter[] { }); - var expectedItemUrl = $"https://deliver.kontent.ai:443/{options.ProjectId}/items/item_codename"; + var expectedItemUrl = $"https://deliver.kontent.ai:443/{options.EnvironmentId}/items/item_codename"; Assert.Equal(expectedItemUrl, actualItemUrl); } [Fact] public void GetItemsUrl_ReturnsItemsUrl() { - var options = new DeliveryOptions() { ProjectId = Guid.NewGuid().ToString() }; + var options = new DeliveryOptions() { EnvironmentId = Guid.NewGuid().ToString() }; var optionsMonitor = new FakeOptionsMonitor(options); var deliveryEndpointUrlBuilder = new DeliveryEndpointUrlBuilder(optionsMonitor); var actualItemsUrl = deliveryEndpointUrlBuilder.GetItemsUrl(new IQueryParameter[] { }); - var expectedItemsUrl = $"https://deliver.kontent.ai:443/{options.ProjectId}/items"; + var expectedItemsUrl = $"https://deliver.kontent.ai:443/{options.EnvironmentId}/items"; Assert.Equal(expectedItemsUrl, actualItemsUrl); } [Fact] public void GetItemsFeedUrl_ReturnsItemsFeedUrl() { - var options = new DeliveryOptions() { ProjectId = Guid.NewGuid().ToString() }; + var options = new DeliveryOptions() { EnvironmentId = Guid.NewGuid().ToString() }; var optionsMonitor = new FakeOptionsMonitor(options); var deliveryEndpointUrlBuilder = new DeliveryEndpointUrlBuilder(optionsMonitor); var actualItemsFeedUrl = deliveryEndpointUrlBuilder.GetItemsFeedUrl(new IQueryParameter[] { }); - var expectedItemsFeedUrl = $"https://deliver.kontent.ai:443/{options.ProjectId}/items-feed"; + var expectedItemsFeedUrl = $"https://deliver.kontent.ai:443/{options.EnvironmentId}/items-feed"; Assert.Equal(expectedItemsFeedUrl, actualItemsFeedUrl); } [Fact] public void GetTypeUrl_ReturnsTypeUrl() { - var options = new DeliveryOptions() { ProjectId = Guid.NewGuid().ToString() }; + var options = new DeliveryOptions() { EnvironmentId = Guid.NewGuid().ToString() }; var optionsMonitor = new FakeOptionsMonitor(options); var deliveryEndpointUrlBuilder = new DeliveryEndpointUrlBuilder(optionsMonitor); var actualTypeUrl = deliveryEndpointUrlBuilder.GetTypeUrl("type_codename", new IQueryParameter[] { }); - var expectedTypeUrl = $"https://deliver.kontent.ai:443/{options.ProjectId}/types/type_codename"; + var expectedTypeUrl = $"https://deliver.kontent.ai:443/{options.EnvironmentId}/types/type_codename"; Assert.Equal(expectedTypeUrl, actualTypeUrl); } [Fact] public void GetTypesUrl_ReturnsTypesUrl() { - var options = new DeliveryOptions() { ProjectId = Guid.NewGuid().ToString() }; + var options = new DeliveryOptions() { EnvironmentId = Guid.NewGuid().ToString() }; var optionsMonitor = new FakeOptionsMonitor(options); var deliveryEndpointUrlBuilder = new DeliveryEndpointUrlBuilder(optionsMonitor); var actualTypesUrl = deliveryEndpointUrlBuilder.GetTypesUrl(new IQueryParameter[] { }); - var expectedTypesUrl = $"https://deliver.kontent.ai:443/{options.ProjectId}/types"; + var expectedTypesUrl = $"https://deliver.kontent.ai:443/{options.EnvironmentId}/types"; Assert.Equal(expectedTypesUrl, actualTypesUrl); } [Fact] public void GetContentElementUrl_ReturnsContentElementUrl() { - var options = new DeliveryOptions() { ProjectId = Guid.NewGuid().ToString() }; + var options = new DeliveryOptions() { EnvironmentId = Guid.NewGuid().ToString() }; var optionsMonitor = new FakeOptionsMonitor(options); var deliveryEndpointUrlBuilder = new DeliveryEndpointUrlBuilder(optionsMonitor); var actualContentElementUrl = deliveryEndpointUrlBuilder .GetContentElementUrl("content_type_codename", "content_element_codename"); - var expectedContentElementUrl = $"https://deliver.kontent.ai:443/{options.ProjectId}/types/content_type_codename/elements/content_element_codename"; + var expectedContentElementUrl = $"https://deliver.kontent.ai:443/{options.EnvironmentId}/types/content_type_codename/elements/content_element_codename"; Assert.Equal(expectedContentElementUrl, actualContentElementUrl); } [Fact] public void GetTaxonomyUrl_ReturnsTaxonomyUrl() { - var options = new DeliveryOptions() { ProjectId = Guid.NewGuid().ToString() }; + var options = new DeliveryOptions() { EnvironmentId = Guid.NewGuid().ToString() }; var optionsMonitor = new FakeOptionsMonitor(options); var deliveryEndpointUrlBuilder = new DeliveryEndpointUrlBuilder(optionsMonitor); var actualTaxonomyUrl = deliveryEndpointUrlBuilder.GetTaxonomyUrl("taxonomy_codename"); - var expectedTaxonomyUrl = $"https://deliver.kontent.ai:443/{options.ProjectId}/taxonomies/taxonomy_codename"; + var expectedTaxonomyUrl = $"https://deliver.kontent.ai:443/{options.EnvironmentId}/taxonomies/taxonomy_codename"; Assert.Equal(expectedTaxonomyUrl, actualTaxonomyUrl); } [Fact] public void GetTaxonomiesUrl_ReturnsTaxonomiesUrl() { - var options = new DeliveryOptions() { ProjectId = Guid.NewGuid().ToString() }; + var options = new DeliveryOptions() { EnvironmentId = Guid.NewGuid().ToString() }; var optionsMonitor = new FakeOptionsMonitor(options); var deliveryEndpointUrlBuilder = new DeliveryEndpointUrlBuilder(optionsMonitor); var actualTaxonomiesUrl = deliveryEndpointUrlBuilder.GetTaxonomiesUrl(new IQueryParameter[] { }); - var expectedTaxonomiesUrl = $"https://deliver.kontent.ai:443/{options.ProjectId}/taxonomies"; + var expectedTaxonomiesUrl = $"https://deliver.kontent.ai:443/{options.EnvironmentId}/taxonomies"; Assert.Equal(expectedTaxonomiesUrl, actualTaxonomiesUrl); } [Fact] public void GetLanguagesUrl_ReturnsLanguagesUrl() { - var options = new DeliveryOptions() { ProjectId = Guid.NewGuid().ToString() }; + var options = new DeliveryOptions() { EnvironmentId = Guid.NewGuid().ToString() }; var optionsMonitor = new FakeOptionsMonitor(options); var deliveryEndpointUrlBuilder = new DeliveryEndpointUrlBuilder(optionsMonitor); var actualLanguagesUrl = deliveryEndpointUrlBuilder.GetLanguagesUrl(new IQueryParameter[] { }); - var expectedLanguagesUrl = $"https://deliver.kontent.ai:443/{options.ProjectId}/languages"; + var expectedLanguagesUrl = $"https://deliver.kontent.ai:443/{options.EnvironmentId}/languages"; Assert.Equal(expectedLanguagesUrl, actualLanguagesUrl); } } \ No newline at end of file diff --git a/Kontent.Ai.Urls.Tests/Kontent.Ai.Urls.Tests.csproj b/Kontent.Ai.Urls.Tests/Kontent.Ai.Urls.Tests.csproj index 9e83bb1d..53a2e270 100644 --- a/Kontent.Ai.Urls.Tests/Kontent.Ai.Urls.Tests.csproj +++ b/Kontent.Ai.Urls.Tests/Kontent.Ai.Urls.Tests.csproj @@ -1,7 +1,7 @@  - net6.0 + net8.0 false diff --git a/Kontent.Ai.Urls/Delivery/DeliveryEndpointUrlBuilder.cs b/Kontent.Ai.Urls/Delivery/DeliveryEndpointUrlBuilder.cs index 7182e732..6c3c0195 100644 --- a/Kontent.Ai.Urls/Delivery/DeliveryEndpointUrlBuilder.cs +++ b/Kontent.Ai.Urls/Delivery/DeliveryEndpointUrlBuilder.cs @@ -207,8 +207,8 @@ private string AssembleHost() var endpointUrl = CurrentDeliveryOptions.UsePreviewApi ? CurrentDeliveryOptions.PreviewEndpoint : CurrentDeliveryOptions.ProductionEndpoint; - var projectId = Uri.EscapeDataString(CurrentDeliveryOptions.ProjectId); - var hostUrl = endpointUrl + projectId; + var environmentId = Uri.EscapeDataString(CurrentDeliveryOptions.EnvironmentId); + var hostUrl = endpointUrl + environmentId; return hostUrl; } diff --git a/Kontent.Ai.Urls/Kontent.Ai.Urls.csproj b/Kontent.Ai.Urls/Kontent.Ai.Urls.csproj index a881e3fc..a01a83f3 100644 --- a/Kontent.Ai.Urls/Kontent.Ai.Urls.csproj +++ b/Kontent.Ai.Urls/Kontent.Ai.Urls.csproj @@ -1,7 +1,7 @@ - net6.0 + net8.0 Kontent s.r.o. Kontent.ai © 2022 Kontent s.r.o. All rights reserved. diff --git a/README.md b/README.md index 5ac65ab8..b7cac447 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,8 @@ | Paradigm | Package | Downloads | Compatibility | Documentation | | -------- | :---------------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------: | -| Async | [![NuGet](https://img.shields.io/nuget/v/Kontent.Ai.Delivery.svg)](https://www.nuget.org/packages/Kontent.Ai.Delivery) | [![NuGet](https://img.shields.io/nuget/dt/Kontent.Ai.Delivery.svg)](https://www.nuget.org/packages/Kontent.Ai.Delivery) | [`net6.0`](https://dotnet.microsoft.com/download/dotnet/6.0) | [📖 Wiki](./docs) | -| Reactive | [![NuGet](https://img.shields.io/nuget/v/Kontent.Ai.Delivery.Rx.svg)](https://www.nuget.org/packages/Kontent.Ai.Delivery.Rx) | [![NuGet](https://img.shields.io/nuget/dt/Kontent.Ai.Delivery.Rx.svg)](https://www.nuget.org/packages/Kontent.Ai.Delivery.Rx) | [`net6.0`](https://dotnet.microsoft.com/download/dotnet/6.0) | [📖 Wiki](./docs/retrieving-data/reactive-library.md) | +| Async | [![NuGet](https://img.shields.io/nuget/v/Kontent.Ai.Delivery.svg)](https://www.nuget.org/packages/Kontent.Ai.Delivery) | [![NuGet](https://img.shields.io/nuget/dt/Kontent.Ai.Delivery.svg)](https://www.nuget.org/packages/Kontent.Ai.Delivery) | [`net8.0`](https://dotnet.microsoft.com/download/dotnet/8.0) | [📖 Wiki](./docs) | +| Reactive | [![NuGet](https://img.shields.io/nuget/v/Kontent.Ai.Delivery.Rx.svg)](https://www.nuget.org/packages/Kontent.Ai.Delivery.Rx) | [![NuGet](https://img.shields.io/nuget/dt/Kontent.Ai.Delivery.Rx.svg)](https://www.nuget.org/packages/Kontent.Ai.Delivery.Rx) | [`net8.0`](https://dotnet.microsoft.com/download/dotnet/8.0) | [📖 Wiki](./docs/retrieving-data/reactive-library.md) | ## Summary @@ -30,7 +30,7 @@ Installation via .NET CLI: ## Usage -To retrieve content from your Kontent.ai projects, you'll be using an implementation of the `IDeliveryClient` interface. This is the main interface of the SDK. Here's how you can instantiate and use the Delivery client either [with DI/IoC](#use-dependency-injection-ideal-for-aspnet-core-web-apps "Usage with dependency injection") or [without DI/IoC](#usage-without-iocdi-containers-ideal-for-console-apps-unit-tests "Usage without dependency injection"). +To retrieve content from your Kontent.ai environments, you'll be using an implementation of the `IDeliveryClient` interface. This is the main interface of the SDK. Here's how you can instantiate and use the Delivery client either [with DI/IoC](#use-dependency-injection-ideal-for-aspnet-core-web-apps "Usage with dependency injection") or [without DI/IoC](#usage-without-iocdi-containers-ideal-for-console-apps-unit-tests "Usage without dependency injection"). ### Use dependency injection (ideal for ASP.NET Core web apps) @@ -75,7 +75,7 @@ You can also set up a `DeliveryOptions` manually using the [`DeliveryClientBuild ```csharp IDeliveryClient _client = DeliveryClientBuilder .WithOptions(builder => builder - .WithProjectId("") + .WithEnvironmentId("") .UseProductionApi() .Build()) .Build(); diff --git a/docs/README.md b/docs/README.md index d87c485f..6c43ddeb 100644 --- a/docs/README.md +++ b/docs/README.md @@ -15,7 +15,7 @@ - **Configuration** - [Registering the DeliveryClient to the IServiceCollection in ASP.NET Core](./configuration/dependency-injection.md) - - [Accessing data from multiple projects at the same time using named clients](./configuration/multiple-delivery-clients.md) + - [Accessing data from multiple environments at the same time using named clients](./configuration/multiple-delivery-clients.md) - [Retry capabilities](./configuration/retry-policy.md) - [Delivery options explained](./configuration/delivery-options.md) - **Retrieving data** diff --git a/docs/configuration/delivery-options.md b/docs/configuration/delivery-options.md index 81fb28c0..33114c1c 100644 --- a/docs/configuration/delivery-options.md +++ b/docs/configuration/delivery-options.md @@ -1,4 +1,4 @@ -* `ProjectId` – sets the ID of your Kontent.ai project. This parameter must always be set. +* `EnvironmentId` – sets the ID of your Kontent.ai environment. This parameter must always be set. * `UsePreviewApi` – determines whether to use the Delivery Preview API (instead of the [Production API](https://docs.kontent.ai/reference/delivery-api#section/Production-vs.-Preview)). See [previewing unpublished content](#previewing-unpublished-content) to learn more. * `PreviewApiKey` - sets the API key that is used to retrieve content with the Preview API. (Only used when `UsePreviewApi` is `true`.) * `UseSecureAccess` – determines whether to authenticate requests to the production Delivery API with an API key. See [retrieving secured content](https://docs.kontent.ai/tutorials/develop-apps/get-content/securing-public-access?tech=dotnet#a-retrieving-secured-content) to learn more. diff --git a/docs/configuration/dependency-injection.md b/docs/configuration/dependency-injection.md index 38a8d51f..14d4a9b1 100644 --- a/docs/configuration/dependency-injection.md +++ b/docs/configuration/dependency-injection.md @@ -11,7 +11,7 @@ First, you need to create or extend the *appsettings.json* file. The properties ```json { "DeliveryOptions": { - "ProjectId": "", + "EnvironmentId": "", "PreviewApiKey": "", "UsePreviewApi": "true", "WaitForLoadingNewContent": "true", @@ -71,7 +71,7 @@ or through the `DeliveryClientBuilder` class: ```csharp IDeliveryClient deliveryClient = DeliveryClientBuilder - .WithProjectId("") + .WithEnvironmentId("") .WithContentLinkUrlResolver(CustomContentLinkUrlResolver) .WithRetryPolicyProvider(CustomPolicyProvider>) .WithTypeProvider(CustomTypeProvider) @@ -83,7 +83,7 @@ You can also use the `DeliveryOptionsBuilder` in the `AddDeliveryClient` method. ```csharp services.AddDeliveryClient(builder => builder - .WithProjectId("") + .WithEnvironmentId("") // Example production configuration: .UseProductionApi("") @@ -113,7 +113,7 @@ or through the `DeliveryClientBuilder` class: ```csharp IDeliveryClient deliveryClient = DeliveryClientBuilder - .WithProjectId("") + .WithEnvironmentId("") .WithLoggerFactory(LoggerFactoryImplementation) .Build(); ``` diff --git a/docs/configuration/multiple-delivery-clients.md b/docs/configuration/multiple-delivery-clients.md index 129e9c6e..2f434351 100644 --- a/docs/configuration/multiple-delivery-clients.md +++ b/docs/configuration/multiple-delivery-clients.md @@ -2,7 +2,7 @@ > ⚠️ Mind [because of the issue with the named clients implementation](https://github.com/kontent-ai/delivery-sdk-net/issues/312) we decided to deprecate `AutofacServiceProviderFactory` use `MultipleDeliveryClientFactory` instead. -Sometimes, it's handy to register multiple `IDeliveryClient`s with different configurations (e.g. while accessing different projects, accessing secured and non-secured data at once, or accessing preview and production data at the same time). In those cases, you can take advantage of multiple client registration using factory pattern. +Sometimes, it's handy to register multiple `IDeliveryClient`s with different configurations (e.g. while accessing different environments, accessing secured and non-secured data at once, or accessing preview and production data at the same time). In those cases, you can take advantage of multiple client registration using factory pattern. If you wish to implement support for a DI container of your choice, jump to the [Extending named services support](#extending-named-services-support) section. @@ -32,13 +32,13 @@ public class Startup factoryBuilder => factoryBuilder .AddDeliveryClient ( - "projectA", + "environmentA", deliveryOptionBuilder => deliveryOptionBuilder - .WithProjectId("") + .WithEnvironmentId("") .UseProductionApi() .Build() optionalClientSetup => - optionalClientSetup.WithTypeProvider(new ProjectAProvider()) + optionalClientSetup.WithTypeProvider(new environmentAProvider()) ) .Build() ); @@ -48,7 +48,7 @@ public class Startup ### Registering multiple type providers -If you're accessing two completely different projects, chances are they have a different content model and therefore the generated models for content types will differ. Extend the Startup class as follows: +If you're accessing two completely different environments, chances are they have a different content model and therefore the generated models for content types will differ. Extend the Startup class as follows: ```csharp public class Startup @@ -62,22 +62,22 @@ public class Startup factoryBuilder => factoryBuilder .AddDeliveryClient ( - "projectA", + "environmentA", deliveryOptionBuilder => deliveryOptionBuilder - .WithProjectId("") + .WithEnvironmentId("") .UseProductionApi() .Build(), optionalClientSetup => - optionalClientSetup.WithTypeProvider(new ProjectAProvider()) + optionalClientSetup.WithTypeProvider(new environmentAProvider()) ) .AddDeliveryClient( - "projectB", + "environmentB", deliveryOptionBuilder => deliveryOptionBuilder - .WithProjectId("") + .WithEnvironmentId("") .UseProductionApi() .Build(), optionalClientSetup => - optionalClientSetup.WithTypeProvider(new ProjectBProvider()) + optionalClientSetup.WithTypeProvider(new environmentBProvider()) ) .Build() ); @@ -103,9 +103,9 @@ public class Startup factoryBuilder => factoryBuilder .AddDeliveryClientCache ( - "projectA" + "environmentA" deliveryOptionBuilder => deliveryOptionBuilder - .WithProjectId(ClientAProjectId) + .WithEnvironmentId(ClientAEnvironmentId) .UseProductionApi() .Build(), CacheManagerFactory.Create( @@ -115,7 +115,7 @@ public class Startup CacheType = CacheTypeEnum.Memory })), optionalClientSetup => - optionalClientSetup.WithTypeProvider(new ProjectAProvider()) + optionalClientSetup.WithTypeProvider(new environmentAProvider()) ) .Build() ); @@ -144,16 +144,16 @@ public class Startup factoryBuilder => factoryBuilder .AddDeliveryClient ( - "projectA", + "environmentA", _ => { var options = new DeliveryOptions(); - config.Configuration.GetSection("MultipleDeliveryOptions:ProjectA") + config.Configuration.GetSection("MultipleDeliveryOptions:environmentA") .Bind(options); return options; }, optionalClientSetup => - optionalClientSetup.WithTypeProvider(new ProjectAProvider()) + optionalClientSetup.WithTypeProvider(new environmentAProvider()) ) .Build() ); @@ -172,7 +172,7 @@ public class HomeController : Controller public HomeController(IDeliveryClientFactory deliveryClientFactory) { - _deliveryClient = deliveryClientFactory.Get("projectA"); + _deliveryClient = deliveryClientFactory.Get("environmentA"); } } ``` diff --git a/docs/configuration/retry-policy.md b/docs/configuration/retry-policy.md index ed63c319..cfec7941 100644 --- a/docs/configuration/retry-policy.md +++ b/docs/configuration/retry-policy.md @@ -22,7 +22,7 @@ The default retry policy performs retries using a randomized exponential backoff ```csharp IDeliveryClient client = DeliveryClientBuilder .WithOptions(builder => builder - .WithProjectId("") + .WithEnvironmentId("") .WithDefaultRetryPolicyOptions(new DefaultRetryPolicyOptions { DeltaBackoff = TimeSpan.FromSeconds(1), MaxCumulativeWaitTime = TimeSpan.FromSeconds(10) diff --git a/docs/customization-and-extensibility/strongly-typed-models.md b/docs/customization-and-extensibility/strongly-typed-models.md index 567409f3..dd64cdba 100644 --- a/docs/customization-and-extensibility/strongly-typed-models.md +++ b/docs/customization-and-extensibility/strongly-typed-models.md @@ -28,7 +28,7 @@ The `IDeliveryClient` interface supports fetching of strongly-typed models. ```csharp // Initializes a client IDeliveryClient deliveryClient = DeliveryClientBuilder - .WithProjectId("975bf280-fd91-488c-994c-2f04416e5ee3") + .WithEnvironmentId("975bf280-fd91-488c-994c-2f04416e5ee3") .Build(); // Basic retrieval @@ -104,7 +104,7 @@ You can find sample models at **Tip**: To save time, use the [Kontent.ai .NET code generator](https://github.com/kontent-ai/model-generator-net) and have the strongly typed models of your project's content types generated for you. + > **Tip**: To save time, use the [Kontent.ai .NET code generator](https://github.com/kontent-ai/model-generator-net) and have the strongly typed models of your environment's content types generated for you. ## Implementing a resolver @@ -88,7 +88,7 @@ If the resolver or the content item itself is not available, the object referenc When are content items available? * For live environment, a content item is available when published, and unavailable when deleted or unpublished. -* For preview environment, a content item is available when it exists in the project inventory, and unavailable when deleted. +* For preview environment, a content item is available when it exists in the inventory, and unavailable when deleted. Components are always available, as they are part of the Rich text element. @@ -109,7 +109,7 @@ or within the `IDeliveryClient` instance by using the `DeliveryClientBuilder` cl ```csharp IDeliveryClient client = DeliveryClientBuilder - .WithProjectId("975bf280-fd91-488c-994c-2f04416e5ee3") + .WithEnvironmentId("975bf280-fd91-488c-994c-2f04416e5ee3") // Registers inline content item resolver for the 'YouTube video' type .WithInlineContentItemsResolver(new YoutubeVideoResolver()) // Registers strongly-typed models @@ -144,7 +144,7 @@ or within the `IDeliveryClient` instance by using the `DeliveryClientBuilder` cl ```csharp IDeliveryClient client = DeliveryClientBuilder - .WithProjectId("975bf280-fd91-488c-994c-2f04416e5ee3") + .WithEnvironmentId("975bf280-fd91-488c-994c-2f04416e5ee3") // Registers a custom resolver as the default resolver .WithInlineContentItemsResolver(new MyDefaultResolver()) .Build(); diff --git a/docs/retrieving-data/caching.md b/docs/retrieving-data/caching.md index 9342f337..60cda2e1 100644 --- a/docs/retrieving-data/caching.md +++ b/docs/retrieving-data/caching.md @@ -73,7 +73,7 @@ Read more in [Microsoft docs](https://docs.microsoft.com/en-us/aspnet/core/perfo Use this approach to register the caching package for a specific `DeliveryClient` instance. ```csharp - var client = DeliveryClientBuilder.WithProjectId("").Build(); + var client = DeliveryClientBuilder.WithEnvironmentId("").Build(); var cacheOptions = Options.Create(new DeliveryCacheOptions() { DefaultExpiration = new TimeSpan(2, 0, 0) }) ; var memoryOptions = Options.Create(new MemoryCacheOptions()); var cachedClient = new DeliveryClientCache(CacheManagerFactory.Create(new MemoryCache(memoryOptions), cacheOptions), client); diff --git a/docs/retrieving-data/items-feed.md b/docs/retrieving-data/items-feed.md index 5a85b268..f7e35e74 100644 --- a/docs/retrieving-data/items-feed.md +++ b/docs/retrieving-data/items-feed.md @@ -1,4 +1,4 @@ -To retrieve a large number of items, for example, to warm a local cache, export content or build a static web site, the SDK provides a `IDeliveryItemsFeed` to process items in a streaming fashion. With large projects feed has several advantages over fetching all items in a single API call: +To retrieve a large number of items, for example, to warm a local cache, export content or build a static web site, the SDK provides a `IDeliveryItemsFeed` to process items in a streaming fashion. With large environments, feed has several advantages over fetching all items in a single API call: * Processing can start as soon as the first item is received, there is no need to wait for all items. * Memory consumption is reduced significantly. * There is no risk of request timeouts. diff --git a/docs/retrieving-data/querying-content.md b/docs/retrieving-data/querying-content.md index 1481a76a..35fe7541 100644 --- a/docs/retrieving-data/querying-content.md +++ b/docs/retrieving-data/querying-content.md @@ -1,4 +1,4 @@ -Once you have an instance of the `IDeliveryClient`, you can start querying your project by calling methods on the instance. +Once you have an instance of the `IDeliveryClient`, you can start querying your environment by calling methods on the instance. ```csharp // Retrieves a single content item diff --git a/docs/retrieving-data/reactive-library.md b/docs/retrieving-data/reactive-library.md index f0ddde00..553e4048 100644 --- a/docs/retrieving-data/reactive-library.md +++ b/docs/retrieving-data/reactive-library.md @@ -3,7 +3,7 @@ The [DeliveryObservableProxy class](https://github.com/kontent-ai/delivery-sdk-n The `DeliveryObservableProxy` class constructor accepts an [IDeliveryClient](https://github.com/kontent-ai/delivery-sdk-net/Kontent.Ai.Delivery/IDeliveryClient.cs) instance, therefore you are free to create the `IDeliveryClient` implementation (or its derivatives) in any of the supported ways. ```csharp -public IDeliveryClient DeliveryClient => DeliveryClientBuilder.WithProjectId("975bf280-fd91-488c-994c-2f04416e5ee3").Build(); +public IDeliveryClient DeliveryClient => DeliveryClientBuilder.WithEnvironmentId("975bf280-fd91-488c-994c-2f04416e5ee3").Build(); public DeliveryObservableProxy DeliveryObservableProxy => new DeliveryObservableProxy(DeliveryClient); ``` diff --git a/docs/retrieving-data/secure-and-preview-api.md b/docs/retrieving-data/secure-and-preview-api.md index cd463990..d32019cb 100644 --- a/docs/retrieving-data/secure-and-preview-api.md +++ b/docs/retrieving-data/secure-and-preview-api.md @@ -4,12 +4,12 @@ You can configure the `DeliveryClient` to retrieve either secured or unpublished For security reasons, the `PreviewApiKey` and `SecureAccessApiKey` key should be stored outside of the project file structure. It's recommended to use [Secret Manager](https://docs.microsoft.com/en-us/aspnet/core/security/app-secrets) or [Azure Key Vault](https://docs.microsoft.com/en-us/aspnet/core/security/key-vault-configuration) to store sensitive data. Avoid using `appsettings.json` for API keys. # Secured content -To retrieve secured content, you need to create an instance of the `IDeliveryClient` with a Secure API key. Each Kontent.ai project has its own Secure API key. +To retrieve secured content, you need to create an instance of the `IDeliveryClient` with a Secure API key. Each Kontent.ai environment has its own Secure API key. ```csharp IDeliveryClient client = DeliveryClientBuilder .WithOptions(builder => builder - .WithProjectId("") + .WithEnvironmentId("") .UseProductionApi("") .Build()) .Build(); @@ -26,12 +26,12 @@ or set it to the `IConfiguration` object using the `Configuration["DeliveryOptio ``` # Unpublished content -Similarly, to retrieve unpublished content, you need to create an instance of the `IDeliveryClient` with both Project ID and Preview API key. Each Kontent.ai project has its own Preview API key. +Similarly, to retrieve unpublished content, you need to create an instance of the `IDeliveryClient` with both Environment ID and Preview API key. Each Kontent.ai environment has its own Preview API key. ```csharp IDeliveryClient client = DeliveryClientBuilder .WithOptions(builder => builder - .WithProjectId("") + .WithEnvironmentId("") .UsePreviewApi("") .Build()) .Build(); @@ -46,4 +46,4 @@ or set it to the `IConfiguration` object using the `Configuration["DeliveryOptio } ``` -Learn more about [configuring content preview](https://docs.kontent.ai/tutorials/develop-apps/get-content/configuring-preview-for-content-items) for your app and Kontent.ai project. \ No newline at end of file +Learn more about [configuring content preview](https://docs.kontent.ai/tutorials/develop-apps/get-content/configuring-preview-for-content-items) for your app and Kontent.ai environment. \ No newline at end of file diff --git a/docs/testing/faking.md b/docs/testing/faking.md index dda84f05..74f7d650 100644 --- a/docs/testing/faking.md +++ b/docs/testing/faking.md @@ -18,7 +18,7 @@ You can now use the fake `HttpClient` when creating an instance of the `IDeliver ```csharp IDeliveryClient client = DeliveryClientBuilder - .WithProjectId(Guid.NewGuid()) + .WithEnvironmentId(Guid.NewGuid()) .WithDeliveryHttpClient(new DeliveryHttpClient(httpClient)) .Build(); ```