-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNetworkManagerProtocol.h
More file actions
34 lines (27 loc) · 1.28 KB
/
NetworkManagerProtocol.h
File metadata and controls
34 lines (27 loc) · 1.28 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
//
// NetworkManagerProtocol.h
// CodeChallenge
//
// Created by alexey novikov on 31.03.2018.
//
#import <Foundation/Foundation.h>
// this protocol describes the low-level network interaction interface that is never exposed to view controllers,
// but only to the business logic controller.
// object implementing it will know how to create NSURLSessionTasks, will be aware of the base URL, and will form the request parameters.
typedef void(^DataSuccessBlock)(NSData *imageData)
typedef void(^SuccessBlock)(NSDictionary *payload);
typedef void(^FailureBlock)(NSError *error);
@protocol NetworkManagerProtocol <NSObject>
- (void)fetchRepositoriesWithOffset:(NSUInteger)offset
limit:(NSUInteger)limit
successBlock:(SuccessBlock)success
failureBlock:(FailureBlock)failure;
- (void)fetchCommitsForRepository:(NSString *)repository
limit:(NSUInteger)limit
successBlock:(SuccessBlock)success
failureBlock:(FailureBlock)failure;
- (void)fetchAvatarForAuthor:(NSString *)author
successBlock:(DataSuccessBlock)success
failureBlock:(FailureBlock)failure;
- (void)cancelAllRequests;
@end