forked from kylebrowning/waterwheel.swift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDIOSSession.h
34 lines (28 loc) · 1.33 KB
/
DIOSSession.h
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
//
// DIOSSession.h
// dios
//
// Created by Kyle Browning on 9/4/14.
// Copyright (c) 2014 Kyle Browning. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <AFNetworking/AFHTTPRequestOperationManager.h>
@interface DIOSSession : AFHTTPRequestOperationManager {
}
@property (nonatomic, strong) NSURL *baseURL;
@property (nonatomic) BOOL signRequests;
@property (nonatomic, strong) NSString *basicAuthUsername;
@property (nonatomic, strong) NSString *basicAuthPassword;
+ (DIOSSession *) sharedSession;
- (void) sendRequestWithPath:(NSString*)path
method:(NSString*)method
params:(NSDictionary*)params
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error)) failure;
- (NSMutableURLRequest *) requestWithMethod:(NSString *)method
path:(NSString *)path
parameters:(NSDictionary *)parameters;
+ (void) logResponseSucccessToConsole:(AFHTTPRequestOperation *)operation withResponse:(id)responseObject;
+ (void) logRequestFailuretoConsole:(AFHTTPRequestOperation *)operation withError:(NSError *)error;
- (void) setBasicAuthCredsWithUsername:(NSString *)username andPassword:(NSString*)password;
@end