Is there a RestSharp implementation that works wit

2020-08-14 05:55发布

When I try to add RestSharp to a portable class library project using nuget, I get the following:

Could not install package 'RestSharp 104.1'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.0,Profile=Profile104', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

I assume then it is not supported? If that be the case anyone have any suggestions on how to get this to work?

4条回答
疯言疯语
2楼-- · 2020-08-14 06:26

Another interesting option is Flurl

Flurl is a modern, fluent, asynchronous, testable, portable, buzzword-laden URL builder and HTTP client library.

Code snippet:

var result = await "https://api.mysite.com"
    .AppendPathSegment("person")
    .SetQueryParams(new { a = 1, b = 2 })
    .WithOAuthBearerToken("my_oauth_token")
    .PostJsonAsync(new { first_name = "Frank", last_name = "Underwood" })
    .ReceiveJson<T>();
查看更多
Root(大扎)
3楼-- · 2020-08-14 06:31

You may also want to look at PortableRest. Again, provides similar capabilities (and adheres closely to the API style) to RestSharp for .NET 4.5, Silverlight 5, Windows Phone 8.x, and Windows 8.x, as well as iOS and Android through Xamarin.

查看更多
Evening l夕情丶
4楼-- · 2020-08-14 06:34

You have a portable RestSharp working at:

https://github.com/Geodan/geoserver-csharp/tree/master/RestSharp

It seems it's working well... It uses Json.net portable version too

查看更多
Summer. ? 凉城
5楼-- · 2020-08-14 06:37

You may try RestSharp.Portable. This is a library which offers an API very similar to RestSharp.

查看更多
登录 后发表回答