This is some kind of a RestSharp port to PCL.
Version 3.0.0 will come soon and it will contain breaking changes:
- The
IRestRequest.Credentials
property moved toIRestClient.Credentials
- Credentials for authenticators are specified using the
IRestClient.Credentials
property - New core library that contains all interfaces and other generic stuff
- New interface for proxies
- New interfaces that are an abstraction of the HttpClient and its request/response messages
- Uses now a RestSharp project compatible Method enumeration for HTTP requests
- Support for WebRequest as back-end for RestSharp.Portable
Fix endless loop for OAuth2 and failed requests when a refresh token is available.
Remember the OAuth2 refresh token when calling the GetCurrentToken
function with a set
refresh token. This should fix the problem with exiring access tokens.
- Revert to Portable.BouncyCastle-Signed to be able to use a release version
- Use the JetBrains.Annotations assembly to fix problems when creating CoreCLR assemblies that want to use JetBrains.Annotations too
- Don't discard GetOrPost parameters when using PUT or PATCH
- Fix for issue #42
- Support more headers when using
HttpWebRequest
instead ofHttpClient
- New
UserAgent
property forIRestClient
- Activated automatic decompression for
HttpClient
andHttpWebRequest
- Refactoring to reduce source code duplication by adding a
RestClientBase
class - Allow customization of
HttpWebRequest
creation to allow the usage of client certificates - Support for RSA-SHA1 for platforms with full .NET Framework support
- New OAuth 1.0 test that uses oauthbin.com
- Fixed HttpWebRequest usage for Windows Store apps
- Added PCL for OAuth/OAuth2 with profile 259 (better for platforms that don't target .NET 4.0 or SL5)
- Make all assemblies containing WebRequest implementations signed
- Added RestSharp implementation using WebRequest instead of HttpClient
- Added PCL optimizations (for .NET 4.5 and up)
- Moved all interfaces and other generic stuff into a separate core library that doesn't have any dependencies
- New interfaces that are an abstraction of the HttpClient and its request/response messages
- New interface for proxies
- Uses now a RestSharp project compatible Method enumeration for HTTP requests and all constructors taking a HttpMethod are flagged as obsolete
- The IAuthenticator, ISerializer, IEncoding, and IDeserializer interfaces were moved to the RestSharp.Portable namespace
- Revamped authenticator interfaces
- Provide a way to process the
Www-Authenticate
header - Make HTTP Basic/Digest authenticators work with
Proxy-Authenticate
header - Credentials property moved from
IRestRequest
toIRestClient
- The NTLM authenticator is not needed anymore, because the the credentials from
the
IRestRequest
are automatically used in theHttpClientHandler
which handles the Basic/Digest/NTLM authentication automatically - All authenticators should query the credentials passed to the authenticator
- New
AuthenticationChallengeHandler
which selects one of the registered authenticators in response to aWww-Authenticate
orProxy-Authenticate
challenge.
- Provide a way to process the
- New Gitter OAuth 2.0 client
- Bugfix for issue #29.
- Bugfix for issue #23. Thanks to GeirGrusom
- Bugfix for issue #25. We're using asynchronous locking now.
- Bugfix for issue #24 which should allow using both OAuth 1.0 and 2.0 in Android apps.
- New
Timeout
property to fix issue #13 with CancellationTokenSource.CancelAfter
- Fixes issue #18
- All DateTime(Offset) HTTP header values are encoded as described in RFC 1123 after conversion to UTC/GMT
- All data is converted to a string using the en-US culture (might be a breaking change)
- Fixes issue #17
- New IsSuccess property for IRestResponse
- Fixes issue #15
- Add the ability to provide a custom timestamp provider
- Fixes issue #16
- Remove superfluous "?" when using URL segment parameters in the query string
- Fixed broken SL5 support (thanks to P2SH)
- Fixes issue #11
- IRestClient now derives from IDisposable
- HttpClient is kept alive until the RestClient gets disposed
- Default HTTP header parameters are set for the HttpClient
- Fixes issue #12
- Workaround for the 32k limit of EscapeDataString
- Custom class for URL encoding that's used as fall-back, when the user wants to use EscapeDataString with a byte array (which isn't supported).
- Avoid rebuilding the Basic Authentication header for each request
- Fixed NuGet dependency for the OAuth 1.0 package
- Fixed some problems found by FxCop
- Fixed NuGet package for Xamarin.iOS (upload using nuget instead of NPE)
- Fixed Microsoft.Bcl and Microsoft.Bcl.Build dependencies
- Assemblies are now CLSCompliant (except PCL and SL5, which don't support this attribute)
- Removed all deprecated methods
- Starting from this version, I'll use Semantic Versioning 2.0.0
- Optimizing NuGet dependencies for several platforms
- Clear Accept HTTP header parameter for the SL5 platform for GET requests (Issue #9)
- Add Deflate encoding
- OAuth2AuthorizationRequestHeaderAuthenticator should only check for Authorization header parameter
- Better handling of refresh tokens in the OAuth2AuthorizationRequestHeaderAuthenticator
- Increased compatibility with the original RestSharp project
- BuildUri instead of BuildUrl (deprecated)
- Added AddJsonBody, AddXmlBody, AddQueryParameter, AddObject
- Graceful handling of duplicate parameters (might be a breaking change)
- Dispose HttpClient, HttpRequestMessage and the HttpResponseMessage
- BuildUrl adds a "/" between a base URL and resource if neither of them is empty and the "/" is missing
- Fix BOM for XmlDataContractSerializer
- Better support for OAuth2 refresh tokens by supporting a HTTP 401 by the OAuth2 authenticator (when a refresh token was set)
- Support for parameters in IRestClient.BaseUrl
- Signed OAuth1/OAuth2 assemblies
- Increased compatibility for empty IRestClient.BaseUrl
- Workaround for NuGet pack bug
- Encodings for parameters (get/post/url/query)
- Async. authenticators
- New OAuth2 package
- Cancellable requests
- New OAuth 1.0 package
- .NET Framework 4
- .NET for Windows Store apps
- .NET Native
- Windows Phone 8 and 8.1
- Silverlight 5
- Portable Class Libraries
- Xamarin Android
- Xamarin MonoTouch / iOS
The following is an example to get the ticker from the bitstamp.net website.
public class TickerResult
{
public decimal Last { get; set; }
public decimal High { get; set; }
public decimal Low { get; set; }
public decimal Volume { get; set; }
public decimal Bid { get; set; }
public decimal Ask { get; set; }
}
We use the class with:
using (var client = new RestClient(new Uri("https://www.bitstamp.net/api/")))
{
var request = new RestRequest("ticker", HttpMethod.Get);
var result = await client.Execute<TickerResult>(request);
}
The support for community projects can be found in my subreddit /r/FubarDev.
You can get professional support here: Fubar Development Junker