33
44namespace GoAffPro . Client . Events ;
55
6+ /// <summary>
7+ /// Polling-based event detector for GoAffPro feed endpoints.
8+ /// </summary>
9+ /// <remarks>
10+ /// The detector keeps in-memory seen ID sets and does not persist state.
11+ /// </remarks>
612public sealed class GoAffProEventDetector
713{
814 private readonly IGoAffProClient _client ;
@@ -11,6 +17,12 @@ public sealed class GoAffProEventDetector
1117 private readonly HashSet < string > _seenAffiliateIds = [ ] ;
1218 private readonly HashSet < string > _seenOrderIds = [ ] ;
1319
20+ /// <summary>
21+ /// Initializes a new instance of the <see cref="GoAffProEventDetector"/> class.
22+ /// </summary>
23+ /// <param name="client">Client used for feed polling operations.</param>
24+ /// <param name="pollingInterval">Polling interval. Defaults to 30 seconds.</param>
25+ /// <param name="pageSize">Number of feed records requested per poll. Must be greater than zero.</param>
1426 public GoAffProEventDetector (
1527 IGoAffProClient client ,
1628 TimeSpan ? pollingInterval = null ,
@@ -27,13 +39,30 @@ public GoAffProEventDetector(
2739 _pageSize = pageSize ;
2840 }
2941
42+ /// <summary>
43+ /// Raised when a new order item is detected.
44+ /// </summary>
3045 public event EventHandler < OrderDetectedEventArgs > ? OrderDetected ;
3146
47+ /// <summary>
48+ /// Raised when a new affiliate/traffic item is detected.
49+ /// </summary>
3250 public event EventHandler < AffiliateDetectedEventArgs > ? AffiliateDetected ;
3351
52+ /// <summary>
53+ /// Raised when a new reward item is detected.
54+ /// </summary>
55+ /// <remarks>
56+ /// Currently disabled because <c>/user/feed/rewards</c> is returning HTTP 404
57+ /// as observed on 2026-02-18.
58+ /// </remarks>
3459 [ Obsolete ( "Disabled because /user/feed/rewards currently returns HTTP 404 (observed on 2026-02-18)." ) ]
3560 public event EventHandler < RewardDetectedEventArgs > ? RewardDetected ;
3661
62+ /// <summary>
63+ /// Starts continuous polling and raises events when new items are found.
64+ /// </summary>
65+ /// <param name="cancellationToken">Cancellation token used to stop polling.</param>
3766 public async Task StartAsync ( CancellationToken cancellationToken = default )
3867 {
3968 // Referenced intentionally so the temporarily-disabled event remains part of the public surface.
@@ -57,6 +86,11 @@ public async Task StartAsync(CancellationToken cancellationToken = default)
5786 }
5887 }
5988
89+ /// <summary>
90+ /// Streams newly detected order events.
91+ /// </summary>
92+ /// <param name="cancellationToken">Cancellation token used to stop polling.</param>
93+ /// <returns>An async stream of new order events.</returns>
6094 public async IAsyncEnumerable < OrderEvent > NewOrdersAsync ( [ EnumeratorCancellation ] CancellationToken cancellationToken = default )
6195 {
6296 while ( ! cancellationToken . IsCancellationRequested )
@@ -71,6 +105,11 @@ public async IAsyncEnumerable<OrderEvent> NewOrdersAsync([EnumeratorCancellation
71105 }
72106 }
73107
108+ /// <summary>
109+ /// Streams newly detected affiliate events.
110+ /// </summary>
111+ /// <param name="cancellationToken">Cancellation token used to stop polling.</param>
112+ /// <returns>An async stream of new affiliate events.</returns>
74113 public async IAsyncEnumerable < AffiliateEvent > NewAffiliatesAsync ( [ EnumeratorCancellation ] CancellationToken cancellationToken = default )
75114 {
76115 while ( ! cancellationToken . IsCancellationRequested )
@@ -85,6 +124,15 @@ public async IAsyncEnumerable<AffiliateEvent> NewAffiliatesAsync([EnumeratorCanc
85124 }
86125 }
87126
127+ /// <summary>
128+ /// Streams newly detected reward events.
129+ /// </summary>
130+ /// <param name="cancellationToken">Cancellation token used to stop polling.</param>
131+ /// <returns>An async stream of reward events.</returns>
132+ /// <remarks>
133+ /// Currently disabled because <c>/user/feed/rewards</c> is returning HTTP 404
134+ /// as observed on 2026-02-18.
135+ /// </remarks>
88136 [ Obsolete ( "Disabled because /user/feed/rewards currently returns HTTP 404 (observed on 2026-02-18)." ) ]
89137 public async IAsyncEnumerable < RewardEvent > NewRewardsAsync ( [ EnumeratorCancellation ] CancellationToken cancellationToken = default )
90138 {
0 commit comments