ServerAPI.h
2 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
//
// 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;
@interface ServerAPI : NSObject
+ (instancetype) server;
@property (nonatomic, assign) NSTimeInterval timeOutInterval;
- (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 - History Screen Function
- (void) requestHistory:(NSString *)token atDate:(NSDate *)date withType:(int)type andMode:(int) mode CompletionHandler:(void (^)(HistoryObject *, NSError *)) completion;
- (void) requestHistoryGraph:(NSString *)token withType:(int)type andMode:(int) mode CompletionHandler:(void (^)(HistoryGraphObject *, NSError *)) completion;
- (void) requestHistoryList:(NSString *)token withType:(int)type andMode:(int) mode AtPage:(int) page 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;
@end