Skip to content

an convenient network request util based on AFNetworking

Notifications You must be signed in to change notification settings

llywuchen/LYWebService

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LYWebService

an weak coupling and convenient network request util based on AFNetworking. could support auto Params and Data Parser,auto create reuqest. also support flexible custom Parser settings...

Requirements

AFNetworking

Installation with Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

Then update dependents :

$ sh update.sh

Usage

configure LYWebClient

LYWebClientInstance.endPoint = [NSURL URLWithString:@"http://route.showapi.com"];
[LYWebClientInstance setPublicParams:[[LYPublicParamsDefault alloc] init]];
...    

Creating API

@protocol LYTextApi <LYWebService>

@GET("/967-1")
- (NSURLSessionDataTask*)getInfo:(NSString *)showapi_appid
                    suceessBlock:LY_SUCCESS_BLOCK(NSArray<LYTextModel *> *)callback
failBlock:LY_FAIL_BLOCK(NSString*)errorMessage;

@end

do task

[LYWebRequest(LYTextApi) getInfo:@"my_appSecret" suceessBlock:^(NSArray *result, NSURLResponse *response) {
        NSLog(@"LYWebRequest Suceess");
    } failBlock:^(NSString *errorMessage, NSURLResponse *response, NSError *error) {
        NSLog(@"LYWebRequest fail");
    }];

@end

About

an convenient network request util based on AFNetworking

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published