summaryrefslogtreecommitdiff
path: root/Juick/API.h
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2019-10-31 16:16:48 +0300
committerGravatar Vitaly Takmazov2020-05-12 16:38:25 +0300
commit9d78e7d654c51c22ce4be87efef5bc1f8d5a2d08 (patch)
treedfb028dfca07fdb7bbacc00771f9e865f28fd6d4 /Juick/API.h
parent742e1a0e615a7e07a9f4b4c249227cd63839325f (diff)
Fix authentication
Diffstat (limited to 'Juick/API.h')
-rw-r--r--Juick/API.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/Juick/API.h b/Juick/API.h
new file mode 100644
index 0000000..fcf9fb1
--- /dev/null
+++ b/Juick/API.h
@@ -0,0 +1,39 @@
+//
+// APIClient.h
+// Juick
+//
+// Created by Vitaly Takmazov on 22/08/16.
+// Copyright © 2016 com.juick. All rights reserved.
+//
+#import <Foundation/Foundation.h>
+#import "Message.h"
+#import "DeviceRegistration.h"
+
+@protocol JuickAuthorizationDelegate
+-(void) unauthorized;
+@end
+
+@interface API : NSObject<NSURLSessionDelegate, NSURLSessionTaskDelegate>
+
+@property (nonatomic, strong) id<JuickAuthorizationDelegate> delegate;
+
+-(void) pullNextFromPath:(NSString *)path params:(NSDictionary *)params callback:(void(^)(NSArray<Message *>*, NSError *))callback;
+-(void) postMessage:(NSString *)text result:(void(^)(Message *, NSError *))callback;
+-(void) postReplyToThread:(NSNumber *)mid inReplyTo:(NSNumber *)rid text:(NSString *)text result:(void(^)(Message *, NSError *))callback;
+-(void) postPMToUser:(NSString *)uname text:(NSString *)text result:(void(^)(NSError *))callback;
+-(void) fetchChats:(void(^)(NSArray *, NSError *))callback;
+-(void) fetchChatWithUser:(NSString *)uname callback:(void(^)(NSArray *, NSError *))callback;
+-(void) authenticateWithUser:(NSString *)username password:(NSString *)password callback:(void(^)(BOOL))completed;
+-(void) signout;
+-(void) me:(void(^)(User *, NSError *))callback;
+-(void) refreshDeviceRegistration:(DeviceRegistration *)registrationData callback:(void(^)(BOOL))callback;
+-(void) getUserByName:(NSString *) name callback:(void(^)(User *))callback;
+-(void) fetchImageWithURL:(NSURL *) url callback:(void(^)(NSData *))callback;
+@property (nonatomic, strong) User * currentUser;
+
++(NSString *) messagesUrl;
++(NSString *) threadUrl;
++(NSString *) feedUrl;
++(NSString *) discussionsUrl;
+
+@end