1+ using System ;
12using System . Threading ;
23using System . Threading . Tasks ;
4+ using Parse . Platform . LiveQueries ;
35
46namespace Parse . Abstractions . Platform . LiveQueries ;
57
@@ -9,13 +11,105 @@ namespace Parse.Abstractions.Platform.LiveQueries;
911/// </summary>
1012public interface IParseLiveQueryController
1113{
14+ /// <summary>
15+ /// Event triggered when an error occurs during the operation of the ParseLiveQueryController.
16+ /// </summary>
17+ /// <remarks>
18+ /// This event provides details about a live query operation failure, such as specific error messages,
19+ /// error codes, and whether automatic reconnection is recommended.
20+ /// It is raised in scenarios like:
21+ /// - Receiving an error response from the LiveQuery server.
22+ /// - Issues with subscriptions, unsubscriptions, or query updates.
23+ /// Subscribers to this event can use the provided <see cref="ParseLiveQueryErrorEventArgs"/> to
24+ /// understand the error and implement appropriate handling mechanisms.
25+ /// </remarks>
26+ public event EventHandler < ParseLiveQueryErrorEventArgs > Error ;
27+
28+ /// <summary>
29+ /// Establishes a connection to the live query server asynchronously.
30+ /// </summary>
31+ /// <param name="cancellationToken">
32+ /// A cancellation token that can be used to cancel the connection process. If the token is triggered,
33+ /// the connection process will be terminated.
34+ /// </param>
35+ /// <returns>
36+ /// A task that represents the asynchronous connection operation.
37+ /// </returns>
38+ /// <exception cref="TimeoutException">
39+ /// Thrown when the connection request times out before receiving confirmation from the server.
40+ /// </exception>
1241 Task ConnectAsync ( CancellationToken cancellationToken = default ) ;
1342
43+ /// <summary>
44+ /// Subscribes to a live query, enabling real-time updates for the specified query object.
45+ /// </summary>
46+ /// <typeparam name="T">
47+ /// The type of the ParseObject associated with the live query.
48+ /// </typeparam>
49+ /// <param name="liveQuery">
50+ /// The live query instance to subscribe to. It contains details about the query and its parameters.
51+ /// </param>
52+ /// <param name="cancellationToken">
53+ /// A token to monitor for cancellation requests. It allows the operation to be canceled if requested.
54+ /// </param>
55+ /// <returns>
56+ /// An object representing the active subscription for the specified query, enabling interaction with the subscribed events and updates.
57+ /// </returns>
58+ /// <exception cref="InvalidOperationException">
59+ /// Thrown when attempting to subscribe while the live query connection is in a closed state.
60+ /// </exception>
61+ /// <exception cref="TimeoutException">
62+ /// Thrown when the subscription request times out before receiving confirmation from the server.
63+ /// </exception>
1464 Task < IParseLiveQuerySubscription > SubscribeAsync < T > ( ParseLiveQuery < T > liveQuery , CancellationToken cancellationToken = default ) where T : ParseObject ;
1565
66+ /// <summary>
67+ /// Updates an active subscription. This method modifies the parameters of an existing subscription for a specific query.
68+ /// </summary>
69+ /// <param name="liveQuery">
70+ /// The live query object that holds the query parameters to be updated.
71+ /// </param>
72+ /// <param name="requestId">
73+ /// The unique identifier of the subscription to update.
74+ /// </param>
75+ /// <param name="cancellationToken">
76+ /// A token to monitor for cancellation requests, allowing the operation to be cancelled before completion.
77+ /// </param>
78+ /// <typeparam name="T">
79+ /// The type of the ParseObject that the query targets.
80+ /// </typeparam>
81+ /// <returns>
82+ /// A task that represents the asynchronous operation of updating the subscription.
83+ /// </returns>
1684 Task UpdateSubscriptionAsync < T > ( ParseLiveQuery < T > liveQuery , int requestId , CancellationToken cancellationToken = default ) where T : ParseObject ;
1785
86+ /// <summary>
87+ /// Unsubscribes from a live query subscription associated with the given request identifier.
88+ /// </summary>
89+ /// <param name="requestId">
90+ /// The unique identifier of the subscription to unsubscribe from.
91+ /// </param>
92+ /// <param name="cancellationToken">
93+ /// A cancellation token that can be used to cancel the unsubscription operation before completion.
94+ /// </param>
95+ /// <returns>
96+ /// A task that represents the asynchronous unsubscription operation.
97+ /// </returns>
98+ /// <exception cref="TimeoutException">
99+ /// Thrown if the unsubscription process does not complete within the specified timeout period.
100+ /// </exception>
18101 Task UnsubscribeAsync ( int requestId , CancellationToken cancellationToken = default ) ;
19102
103+ /// <summary>
104+ /// Closes the live query connection asynchronously.
105+ /// </summary>
106+ /// <param name="cancellationToken">
107+ /// A token to monitor for cancellation requests while closing the live query connection.
108+ /// If the operation is canceled, the task will terminate early.
109+ /// </param>
110+ /// <returns>
111+ /// A task that represents the asynchronous operation of closing the live query connection.
112+ /// The task completes when the connection is fully closed and resources are cleaned up.
113+ /// </returns>
20114 Task CloseAsync ( CancellationToken cancellationToken = default ) ;
21115}
0 commit comments