Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

153 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OSRESTfulClient

Making a http request has never been easier.

OSRESTfulClient is a light-weight RESTful client for iOS APP. Inspired by Retrofit and Masonry. Support Http/2.

Usage

Making a request

Making a request is very easy, just use the builder pattern:

OSRESTfulEndpoint *endpoint = [[OSRESTfulEndpoint alloc] initWithBaseURLString:@"https://api.github.com"];
OSRESTfulClient *client = [[OSRESTfulClient alloc] initWithEndpoint:endpoint
                                                          configuration:[NSURLSessionConfiguration defaultSessionConfiguration]];
BFTask *request = client.builder
						.setPath(@"/repos")
						.withGet
						.buildArrayWithModel([OSRepo class])
						.request;

Or path with parameters:

OSRESTfulEndpoint *endpoint = [[OSRESTfulEndpoint alloc] initWithBaseURLString:@"https://api.github.com"];
OSRESTfulClient *client = [[OSRESTfulClient alloc] initWithEndpoint:endpoint
                                                          configuration:[NSURLSessionConfiguration defaultSessionConfiguration]];
BFTask *request = client.builder
                        .setPath(@"/users/{user_id}/repos")
						.setPathParams(@{@"user_id" : userId})
						.withGet
						.buildArrayWithModel([OSRepo class])
						.request;

And get the result:

[request continueWithSuccessBlock:^id(BFTask *task) {
	 OSRepo *repo = task.result;
	 /* do something... */
    return nil;
}];

You can take full advantage of Bolts: chaining task together, error handling, tasks in series, tasks in parallel, ...etc.

Requirements

  • iOS7

Dependency

Installation

OSRESTfulClient is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "OSRESTfulClient"

Author

Kros Huang, kros@osolve.com

License

OSRESTfulClient is available under the MIT license. See the LICENSE file for more info.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages