/
FSURLOperation.h
30 lines (24 loc) · 1.26 KB
/
FSURLOperation.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
//
// FSURLOperation.h
//
// Created by Christopher Miller on 10/31/11.
// Copyright (c) 2011 Christopher Miller. All rights reserved.
//
// Pilfers liberally from Gowalla's AFNetworking. I hope they don't mind.
#import <Foundation/Foundation.h>
@interface FSURLOperation : NSOperation
@property (strong) NSURLRequest* request; // changing this after the request has started produces undefined behavior.
@property (strong) NSHTTPURLResponse* response;
@property (strong) NSMutableData* payload;
@property (strong) NSError * error;
@property (strong) NSThread* targetThread; // changing this after the request has started produces undefined behavior.
@property (copy) void(^onFinish)(NSHTTPURLResponse* resp, NSData* payload, NSError* error);
@property (weak) id delegate;
@property (assign) SEL callback;
+ (FSURLOperation*)URLOperationWithRequest:(NSURLRequest*)req
completionBlock:(void(^)(NSHTTPURLResponse* resp, NSData* payload, NSError* error))completion;
+ (FSURLOperation*)URLOperationWithRequest:(NSURLRequest*)req
completionBlock:(void(^)(NSHTTPURLResponse* resp, NSData* payload, NSError* error))completion
onThread:(NSThread*)thread;
- (id)initWithRequest:(NSURLRequest*)_request;
@end