No description or website provided.
Objective-C Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Example
OSRESTfulClient
.gitignore
.travis.yml
LICENSE
OSRESTfulClient.podspec
README.md
_Pods.xcodeproj

README.md

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.