ServerAPI.h
3.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//
// ServerAPI.h
// LifeLog
//
// Created by Nguyen Van Phong on 7/30/17.
// Copyright © 2017 PhongNV. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "Entities.h"
extern NSString *const kServerAddress;
extern NSString *const kUser;
extern NSString *const kToken;
extern NSString *const kNotificationToken;
@interface ServerAPI : NSObject
+ (instancetype) server;
@property (nonatomic, assign) NSTimeInterval timeOutInterval;
#pragma mark - Login and Register
- (void)loginWithEmail:(NSString *)email Password:(NSString *)password CompletionHandler: (void (^)(User *, NSString *, NSError *)) completion;
- (void)registerUserWithParams:(NSDictionary *)params CompletionHandler: (void (^)(User *, NSString *, NSError *)) completion;
- (void)uploadImage:(NSString *)token andImageData:(NSData *)data CompletionHandler:(void (^)(NSString *, NSError *)) completion;
- (void)forgetPass:(NSString *)email CompletionHandler:(void (^)(NSError *)) completion;
- (void)confirmForgetPass:(NSString *)email withConfirm:(NSString *)confirm CompletionHandler:(void (^)(NSError *)) completion;
#pragma mark - Home Screen Function
- (void)requestTopWithMode:(int)mode andDate:(NSString *)date CompletionHandler:(void (^)(TopObject *, NSError *)) completion;
- (void)requestCreateLog:(int)mode withStep:(int)numStep startDate:(NSString *)startDate endDate:(NSString *)endDate CompletionHandler:(void (^)(NSError *))completion;
#pragma mark - History Screen Function
- (void) requestHistory:(NSString *)token startDate:(NSDate *)startDate endDate:(NSDate *)endDate CompletionHandler:(void (^)(NSArray *, NSError *)) completion;
- (void) requestHistoryList:(NSString *)token startDate:(NSDate *)startDate endDate:(NSDate *)endDate CompletionHandler:(void (^)(NSArray *, NSError *)) completion;
- (void) requestJoinGroup:(NSString *)token groupID: (int) groupID CompletionHandler:(void (^)(NSError *)) completion;
-(void) requestCreateGroup:(NSString *)token withGroup:(GroupObject *)group CompletionHandler:(void (^)(GroupObject *, NSError *)) completion;
- (void) requestGroupList:(NSString *)token CompletionHandler:(void (^)(NSArray *, NSError *)) completion;
#pragma mark - SNS Screen Function
/*
Get tweet of group and get recent tweet is same API
If groupID equal -1, it will request recent tweet. Otherwise will request tweet of group
*/
- (void) requestTweetsList:(NSString *)token groupID: (int) groupID withPage:(int)page CompletionHandler:(void (^)(NSArray *, NSError *)) completion;
- (void) searchGroup:(NSString *)token withKey:(NSString *)key andPage:(int)page CompletionHandler:(void (^)(NSArray *, NSError *)) completion;
#pragma mark - Group Function
- (void) getGroupDetail:(NSString *)token withGroupID:(int)groupID CompletionHandler:(void (^)(GroupObject *, NSError *)) completion;
- (void) requestMemberList:(NSString *)token groupID: (int) groupID withPage:(int)page CompletionHandler:(void (^)(NSArray *, NSError *)) completion;
#pragma mark - Ranking API
- (void) requestRankingList:(NSString *)token startDate:(NSDate *)startDate endDate:(NSDate *)endDate mode:(int) mode page:(int) page CompletionHandler:(void (^)(NSArray *, NSError *)) completion;
#pragma mark - Common API
- (void)refreshToken: (NSString *)userID CompletionHandler:(void (^)(NSString *, NSError *))completion;
@end