Objective-C的Wunderlist API包装器
为了使用AFWunderlist,您还需要将AFNetworking导入到项目中,由Mattt提供。如果您使用CocoaPods,AFNetworking将为您安装。完成此操作后,您必须将WLClient类导入到您的类或类中。
#import "WLClient.h"
然后,使用共享客户端运行您的方法(几乎所有方法都使用分块)。
[[WLClient sharedClient]getUserFriendsWithCompletion:^(NSDictionary *response, BOOL success) {
//Handle the response over there, that will be a BOOL telling you if the request has been successful and, in some cases, a NSDictionary with the data retreived.
}];
有了这些,您就可以开始了!
所有方法都按以下方式执行:
如果有块
[[WLClient sharedClient]aRandomMethod:^(NSDictionary *response, BOOL success) {
//Handle the completion block
}];
如果没有块
[[WLClient sharedClient]logout];
这里有目前可用的所有方法
loginWithEmail:(NSString *)email andPassword:(NSString *)pass withCompletion:(statusBlock)completion;
返回一个AFWunderlist将用于创建所有请求的令牌
getUserBasicInformationWithCompletion:(responseBlock)completion;
返回一个包含用户基本信息的字典
getUserFriendsWithCompletion:(responseBlock)completion;
返回一个包含用户好友列表的字典
getUserSettingsWithCompletion:(responseBlock)completion;
返回一个包含用户在官方Wunderlist客户端中使用的设置的字典
logout;
移除存储的用于发送请求的令牌
isLoged;
如果是true,则表示用户已登录,我的意思是,AFWunderlist有令牌。如果是false,则用户未登录且无法发起请求
getListsWithCompletion:(responseBlock)completion;
返回包含所有列表的字典
createNewListWithTitle:(NSString *)title andCompletion:(statusBlock)completion;
通过传递方法中的新列表将具有的标题来创建一个列表
deleteListWithID:(NSString *)listID andCompletion:(statusBlock)completion;
通过传递要删除的列表ID来删除一个列表
shareListWithID:(NSString *)listID withUser:(NSString *)email andCompletion:(statusBlock)completion;
通过传递方法中的列表ID和接收者的电子邮件来与其他人共享列表
getTasksWithCompletion:(responseBlock)completion;
返回包含所有任务的字典
createTaskWithTitle:(NSString *)title insideList:(NSString *)listID withCompletion:(statusBlock)completion;
通过传递方法中的新任务将具有的标题和列表ID来创建一个任务
createComment:(NSString *)comment atTask:(NSString *)taskID withCompletion:(statusBlock)completion;
通过传递方法中的评论文本和任务ID在任务中创建一条评论
getTasksCommentsWithID:(NSString *)taskID andCompletion:(responseBlock)completion;
返回包含任务中所有评论的字典
deleteTaskWithID:(NSString *)taskID andCompletion:(statusBlock)completion;
通过传递要删除的任务ID来删除一个任务
getRemidersWithCompletion:(responseBlock)completion;
返回包含所有提醒的字典
createReminderAtTaskWithID:(NSString *)taskID withDate:(NSDate *)date andCompletion:(statusBlock)completion;
通过传递方法中的任务ID和日期在任务中创建一条提醒
AFWunderlist采用MIT许可证。