-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7bb2aa2
commit 4eb7086
Showing
6 changed files
with
399 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,24 @@ | ||
namespace Ecng.Net; | ||
|
||
/// <summary> | ||
/// Defines a standard contract for a connection that can be established and disconnected. | ||
/// </summary> | ||
public interface IConnection | ||
{ | ||
/// <summary> | ||
/// Occurs when the connection state has changed. | ||
/// </summary> | ||
event Action<ConnectionStates> StateChanged; | ||
|
||
/// <summary> | ||
/// Asynchronously connects to a target. | ||
/// </summary> | ||
/// <param name="cancellationToken">A token to monitor for cancellation requests.</param> | ||
/// <returns>A task representing the asynchronous operation.</returns> | ||
ValueTask ConnectAsync(CancellationToken cancellationToken); | ||
|
||
/// <summary> | ||
/// Disconnects the current connection. | ||
/// </summary> | ||
void Disconnect(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,16 @@ | ||
namespace Ecng.Net; | ||
|
||
/// <summary> | ||
/// Represents an exception that is thrown when a RestSharp operation fails. | ||
/// </summary> | ||
/// <param name="message">The error message that explains the reason for the exception.</param> | ||
/// <param name="response"> | ||
/// The <see cref="RestResponse"/> associated with the failed RestSharp operation. | ||
/// </param> | ||
public class RestSharpException(string message, RestResponse response) : InvalidOperationException(message) | ||
{ | ||
/// <summary> | ||
/// Gets the response returned from the RestSharp call that caused the exception. | ||
/// </summary> | ||
public RestResponse Response { get; } = response ?? throw new ArgumentNullException(nameof(response)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.