Skip to content

Conversation

@sevcik-martin
Copy link
Contributor

@sevcik-martin sevcik-martin commented May 15, 2025

Motivation

Fixes #404

Checklist

  • Code follows coding conventions held in this repo
  • Automated tests have been added
  • Tests are passing
  • Docs have been updated (if applicable)
  • Temporary settings (e.g. variables used during development and testing) have been reverted to defaults

How to test

Verify the client can be used with the sync v2 endpoints

@sevcik-martin sevcik-martin requested review from a team and pokornyd as code owners May 15, 2025 12:53
@codecov
Copy link

codecov bot commented May 15, 2025

Codecov Report

Attention: Patch coverage is 91.00000% with 18 lines in your changes missing coverage. Please review.

Project coverage is 88.21%. Comparing base (9327b2c) to head (d3225c1).
Report is 13 commits behind head on master.

Files with missing lines Patch % Lines
Kontent.Ai.Delivery.Caching/DeliveryClientCache.cs 0.00% 6 Missing ⚠️
Kontent.Ai.Delivery/DeliveryClient.cs 83.33% 4 Missing and 2 partials ⚠️
...ntent.Ai.Delivery/SyncV2/DeliverySyncV2Response.cs 78.57% 3 Missing ⚠️
...ent.Ai.Urls/Delivery/DeliveryEndpointUrlBuilder.cs 96.59% 1 Missing and 2 partials ⚠️

❗ There is a different number of reports uploaded between BASE (9327b2c) and HEAD (d3225c1). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (9327b2c) HEAD (d3225c1)
2 1
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #405      +/-   ##
==========================================
- Coverage   93.28%   88.21%   -5.07%     
==========================================
  Files         130      144      +14     
  Lines        2783     3021     +238     
  Branches      350      360      +10     
==========================================
+ Hits         2596     2665      +69     
- Misses        179      216      +37     
- Partials        8      140     +132     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

/// <summary>
/// Initializes synchronization of changes in content items, content types, taxonomies or languages based on the specified parameters. After the initialization, you'll get an X-Continuation token in the response.
/// </summary>
/// <param name="parameters">A collection of query parameters, for example, for filtering.</param>
Copy link
Member

Choose a reason for hiding this comment

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

I guess this method docs were copypasted from v1, because the method doesn't have any params, so the summary should be adjusted and param entry removed altogether

using System.Threading.Tasks;
using System.Threading.Tasks;

namespace Kontent.Ai.Delivery.Abstractions
Copy link
Member

Choose a reason for hiding this comment

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

I don't see GetSyncAsync or GetSyncV2Async in the extension methods. there are other methods present in client which are not provided through the extensions, so this is fine by me, just wanted to point it out for consideration, whether it would make sense to have this here too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think since there will be no params the post is redundant and I have removed it

namespace Kontent.Ai.Delivery.Sync
namespace Kontent.Ai.Delivery.Sync;

internal sealed class SyncItemData : ISyncItemData
Copy link
Member

Choose a reason for hiding this comment

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

I see this class was inherited from v1 of sync api, but is there a reason why it's internal sealed, while all other classes related to sync (SyncV2Language, SyncV2ContentType) are public?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

there was just a switch to file scoped namespace in this class

Copy link
Contributor Author

Choose a reason for hiding this comment

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

other classes fixed

/// Initializes a new instance of <see cref="SyncV2Item"/> class.
/// </summary>
[JsonConstructor]
public SyncV2Item(object stronglyTypedData, ISyncV2ItemData data, string changeType, DateTime timestamp)
Copy link
Member

Choose a reason for hiding this comment

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

unused constructor param stronglyTypedData


namespace Kontent.Ai.Delivery.SyncV2
{
internal sealed class SyncV2ItemData : ISyncV2ItemData
Copy link
Member

Choose a reason for hiding this comment

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

again, should this be internal sealed and not public (or other way around)?

/// Initializes a new instance of <see cref="SyncV2Language"/> class.
/// </summary>
[JsonConstructor]
public SyncV2Language(object stronglyTypedData, ISyncV2LanguageData data, string changeType, DateTime timestamp)
Copy link
Member

Choose a reason for hiding this comment

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

unused constructor param stronglyTypedData

/// Initializes a new instance of <see cref="SyncV2Taxonomy"/> class.
/// </summary>
[JsonConstructor]
public SyncV2Taxonomy(object stronglyTypedData, ISyncV2TaxonomyData data, string changeType, DateTime timestamp)
Copy link
Member

Choose a reason for hiding this comment

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

unused constructor param stronglyTypedData

/// Generates a URL for sync v2 initialization.
/// </summary>
/// <param name="parameters">Filtering parameters.</param>
/// <returns>A valid URL containing correctly formatted parameters.</returns>
Copy link
Member

Choose a reason for hiding this comment

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

again, no filtering params for this function, even though its docs suggest otherwise.

}

[Fact]
public async Task SyncV2Api_PostSyncV2InitAsync_WithParameters_GetContinuationToken()
Copy link
Member

Choose a reason for hiding this comment

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

misleading function name, tested method does not accept any parameters

/// <summary>
/// Represents a response from Kontent.ai Sync API. Response includes continuation token for subsequent synchronization calls. Sync initialization should always return an empty list.
/// </summary>
public interface IDeliverySyncV2InitResponse : IResponse
Copy link
Member

Choose a reason for hiding this comment

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

I get that sync init should always return an empty list, but since IDeliverySyncV2InitResponse and IDeliverySyncV2Response are identical, is this duplicity needed for anything? perhaps future updates? otherwise, I'd just get rid of the duplicit interface definition

@pokornyd pokornyd self-requested a review May 29, 2025 12:33
@pokornyd pokornyd merged commit c1e4e3e into kontent-ai:master Jul 2, 2025
3 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Introduce SyncAPI v2

2 participants