Initial commit
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
namespace RobotNet10.Script.IO;
|
||||
|
||||
/// <summary>
|
||||
/// Interface for HTTP connection operations.
|
||||
/// </summary>
|
||||
public interface IHttpConnection : IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the base URL of the HTTP connection.
|
||||
/// </summary>
|
||||
string BaseUrl { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether the connection is currently connected.
|
||||
/// </summary>
|
||||
bool IsConnected { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Connects to the HTTP endpoint.
|
||||
/// </summary>
|
||||
Task ConnectAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Disconnects from the HTTP endpoint.
|
||||
/// </summary>
|
||||
Task DisconnectAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Sends a GET request to the specified path.
|
||||
/// </summary>
|
||||
/// <param name="path">The path relative to BaseUrl.</param>
|
||||
/// <param name="headers">Optional headers to include in the request.</param>
|
||||
/// <returns>The response content as string.</returns>
|
||||
Task<string> GetAsync(string path, Dictionary<string, string>? headers = null);
|
||||
|
||||
/// <summary>
|
||||
/// Sends a POST request to the specified path.
|
||||
/// </summary>
|
||||
/// <param name="path">The path relative to BaseUrl.</param>
|
||||
/// <param name="content">The content to send.</param>
|
||||
/// <param name="contentType">The content type (default: application/json).</param>
|
||||
/// <param name="headers">Optional headers to include in the request.</param>
|
||||
/// <returns>The response content as string.</returns>
|
||||
Task<string> PostAsync(string path, string content, string contentType = "application/json", Dictionary<string, string>? headers = null);
|
||||
|
||||
/// <summary>
|
||||
/// Sends a PUT request to the specified path.
|
||||
/// </summary>
|
||||
/// <param name="path">The path relative to BaseUrl.</param>
|
||||
/// <param name="content">The content to send.</param>
|
||||
/// <param name="contentType">The content type (default: application/json).</param>
|
||||
/// <param name="headers">Optional headers to include in the request.</param>
|
||||
/// <returns>The response content as string.</returns>
|
||||
Task<string> PutAsync(string path, string content, string contentType = "application/json", Dictionary<string, string>? headers = null);
|
||||
|
||||
/// <summary>
|
||||
/// Sends a DELETE request to the specified path.
|
||||
/// </summary>
|
||||
/// <param name="path">The path relative to BaseUrl.</param>
|
||||
/// <param name="headers">Optional headers to include in the request.</param>
|
||||
/// <returns>The response content as string.</returns>
|
||||
Task<string> DeleteAsync(string path, Dictionary<string, string>? headers = null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user