GithubHelp home page GithubHelp logo

codefork / restion Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vinguan/restion

0.0 1.0 0.0 1.72 MB

An unifier of kingdoms Fluent Class Library(FCL) for calling RESTful services in .NET

PowerShell 15.60% C# 84.28% ASP 0.12%

restion's Introduction

Restion

Join the chat at https://gitter.im/vinguan/Restion

I like to call it an unifier of kingdoms portable class library for calling RESTful services in .NET. It unifies the fluent interface kingdom with HttpClient and make http request from PCL a lot more easier.

##Compability Compiled to Profile 259 of PCL which includes the plataforms .NET 4.5, Windows Phone 8.x, Windows 8.x, Windows 10 UWP. It can be used also on iOS and Android with Xamarin.

#Nuget

Install-Package Restion

Features

  • Built using Fluent Interface
IRestionClient restionClient = new RestionClient()
                                   .SetBaseAddress("http://foo.bar.com");

IRestionRequest restionRequest = new RestionRequest("/foo/")
                                     .WithHttpMethod(HttpMethod.Post)
                                     .WithContent(new Foo(){FooName = "1"})
                                     .WithContentMediaType(MediaTypes.ApplicationJson)
                                     .WithContentEnconding(Encoding.UTF8);
  • Full Asynchronously
IRestionResponse<Foo> response = await restionClient.ExecuteRequestAsync<Foo>(restionRequest);
  • Full Extendable
ISerializer serializer = new CustomSerializer(); 
IDeSerializer deSerializer = new CustomDeSerializer(); 

IRestionClient restionClient = new RestionClient()
                                   .SetBaseAddress("http://foo.bar.com")
                                   .SetSerializer(serializer)
                                   .SetDeserializer(deSerializer);

Getting Started

  • Creating IRestionClient By default it uses Json.NET for Serialization and Deserialization
IRestionClient restionClient = new RestionClient()
                                   .SetBaseAddress("http://foo.bar.com");
  • Creating the IRestionRequest
IRestionRequest restionRequest = new RestionRequest("/foo/")
                                     .WithHttpMethod(HttpMethod.Post)
                                     .WithContent(new Foo(){FooName = "1"})
                                     .WithContentMediaType(MediaTypes.ApplicationJson)
                                     .WithContentEnconding(Encoding.UTF8);
  • Executing the Request It returns and instance of IRestionRequest
IRestionResponse<Foo> response = await restionClient.ExecuteRequestAsync<Foo>(restionRequest);

Author

Vinicius Gualberto @Vinguan.

Contribute

Fork me and send the pull requests =).

restion's People

Contributors

vinguan avatar gitter-badger avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.