Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Release v18 #390

Merged
merged 2 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can update to setup-dotnet@v4 😉

with:
dotnet-version: 6.0.x
dotnet-version: 8.0.x
- name: Install dependencies
run: dotnet restore
- name: Build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integrate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ public class DeliveryOptions
public string PreviewEndpoint { get; set; } = "https://preview-deliver.kontent.ai/";

/// <summary>
/// Gets or sets the project identifier.
/// Gets or sets the environment identifier.
/// </summary>
public string ProjectId { get; set; }
public string EnvironmentId { get; set; }

/// <summary>
/// Gets or sets the API key that is used to retrieve content with the Preview API.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public static Task<IDeliveryTaxonomyListingResponse> GetTaxonomiesAsync(this IDe
}

/// <summary>
/// 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.
/// </summary>
/// <param name="client">An instance of the <see cref="IDeliveryClient"/></param>
/// <param name="parameters">An array that contains zero or more query parameters, for example, for paging.</param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public static class DeliveryOptionsExtensions
/// <param name="options">A source.</param>
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;
Expand Down
4 changes: 2 additions & 2 deletions Kontent.Ai.Delivery.Abstractions/IDeliveryClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public interface IDeliveryClient


/// <summary>
/// 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.
/// </summary>
/// <param name="parameters">A collection of query parameters, for example, for paging.</param>
/// <returns>The <see cref="IDeliveryLanguageListingResponse"/> instance that represents the languages. If no query parameters are specified, all languages are returned.</returns>
Expand All @@ -85,7 +85,7 @@ public interface IDeliveryClient
Task<IDeliverySyncInitResponse> PostSyncInitAsync(IEnumerable<IQueryParameter> parameters = null);

/// <summary>
/// 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.
/// </summary>
/// <returns>The <see cref="IDeliverySyncResponse"/> instance that represents the sync response that contains collection of delta updates and continuation token needed for further sync execution.</returns>
Task<IDeliverySyncResponse> GetSyncAsync(string continuationToken);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Authors>Kontent s.r.o.</Authors>
<Company>Kontent s.r.o.</Company>
<Product>Kontent.ai</Product>
Expand Down
6 changes: 3 additions & 3 deletions Kontent.Ai.Delivery.Benchmarks/DeliveryClientBenchmark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<OutputType>Exe</OutputType>
<GenerateProgramFile>false</GenerateProgramFile>
<IsPackable>false</IsPackable>
Expand Down
12 changes: 6 additions & 6 deletions Kontent.Ai.Delivery.Caching.Tests/BinarySerializationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand All @@ -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<Coffee>("brazil_natural_barra_grande");
Expand All @@ -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<Article>();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand Down
8 changes: 4 additions & 4 deletions Kontent.Ai.Delivery.Caching.Tests/ScenarioBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -36,7 +36,7 @@ public class 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;
Expand Down Expand Up @@ -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);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Kontent.Ai.Delivery.Caching/DeliveryClientCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class DeliveryClientCache : IDeliveryClient
private readonly IDeliveryCacheManager _deliveryCacheManager;

/// <summary>
/// Initializes a new instance of the <see cref="DeliveryClientCache"/> class for retrieving cached content of the specified project.
/// Initializes a new instance of the <see cref="DeliveryClientCache"/> class for retrieving cached content of the specified environment.
/// </summary>
/// <param name="cacheManager"></param>
/// <param name="deliveryClient"></param>
Expand Down Expand Up @@ -168,7 +168,7 @@ public Task<IDeliverySyncInitResponse> PostSyncInitAsync(IEnumerable<IQueryParam
}

/// <summary>
/// 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.
/// </summary>
/// <returns>The <see cref="IDeliverySyncResponse"/> instance that represents the sync response that contains collection of delta updates and continuation token needed for further sync execution.</returns>
public Task<IDeliverySyncResponse> GetSyncAsync(string continuationToken)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Authors>Kontent s.r.o.</Authors>
<Company>Kontent s.r.o.</Company>
<Product>Kontent.ai</Product>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -267,15 +267,15 @@ public void AddMultipleDeliveryClientFactory_WithTwoClientsWithCustomTypeProvide
var typeProviderB = A.Fake<ITypeProvider>();
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
Expand All @@ -284,7 +284,7 @@ public void AddMultipleDeliveryClientFactory_WithTwoClientsWithCustomTypeProvide
.AddDeliveryClient(
clientBName,
builder => builder
.WithProjectId(projectBID)
.WithEnvironmentId(environmentBID)
.UseProductionApi()
.Build(),
optionalConfig => optionalConfig
Expand Down Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Authors>Kontent s.r.o.</Authors>
<Product>Kontent.ai</Product>
<Copyright>© 2022 Kontent s.r.o. All rights reserved.</Copyright>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<IContentLinkUrlResolver>();
var contentItemsProcessor = A.Fake<IInlineContentItemsProcessor>();
var contentPropertyMapper = new PropertyMapper();
Expand Down
2 changes: 1 addition & 1 deletion Kontent.Ai.Delivery.Rx.Tests/Fixtures/languages.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"system": {
"id": "00000000-0000-0000-0000-000000000000",
"name": "Default project language",
"name": "Default environment language",
"codename": "default"
}
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion Kontent.Ai.Delivery.Rx/Kontent.Ai.Delivery.Rx.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Authors>Kontent s.r.o.</Authors>
<Company>Kontent s.r.o.</Company>
<Product>Kontent.ai</Product>
Expand Down
Loading
Loading