mirror of
https://github.com/JKorf/CryptoExchange.Net.git
synced 2026-08-12 00:43:03 +00:00
Initial commit
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.Net;
|
||||
using CryptoExchange.Net.Interfaces;
|
||||
|
||||
namespace CryptoExchange.Net.Requests
|
||||
{
|
||||
public class Request : IRequest
|
||||
{
|
||||
private readonly WebRequest request;
|
||||
|
||||
public Request(WebRequest request)
|
||||
{
|
||||
this.request = request;
|
||||
}
|
||||
|
||||
public WebHeaderCollection Headers
|
||||
{
|
||||
get => request.Headers;
|
||||
set => request.Headers = value;
|
||||
}
|
||||
public string Method
|
||||
{
|
||||
get => request.Method;
|
||||
set => request.Method = value;
|
||||
}
|
||||
public Uri Uri
|
||||
{
|
||||
get => request.RequestUri;
|
||||
}
|
||||
|
||||
public void SetProxy(string host, int port)
|
||||
{
|
||||
request.Proxy = new WebProxy(host, port); ;
|
||||
}
|
||||
|
||||
public IResponse GetResponse()
|
||||
{
|
||||
return new Response(request.GetResponse());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System.Net;
|
||||
using CryptoExchange.Net.Interfaces;
|
||||
|
||||
namespace CryptoExchange.Net.Requests
|
||||
{
|
||||
public class RequestFactory : IRequestFactory
|
||||
{
|
||||
public IRequest Create(string uri)
|
||||
{
|
||||
return new Request(WebRequest.Create(uri));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using CryptoExchange.Net.Interfaces;
|
||||
|
||||
namespace CryptoExchange.Net.Requests
|
||||
{
|
||||
public class Response : IResponse
|
||||
{
|
||||
private readonly WebResponse response;
|
||||
|
||||
public Response(WebResponse response)
|
||||
{
|
||||
this.response = response;
|
||||
}
|
||||
|
||||
public Stream GetResponseStream()
|
||||
{
|
||||
return response.GetResponseStream();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user