2018-11-13 12:29:15 -08:00
|
|
|
//
|
|
|
|
|
// MBIMBridgeOperation.h
|
|
|
|
|
// kordophoned
|
|
|
|
|
//
|
|
|
|
|
// Created by James Magahern on 11/13/18.
|
|
|
|
|
// Copyright © 2018 James Magahern. All rights reserved.
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
#import <Foundation/Foundation.h>
|
2023-01-17 16:16:23 -08:00
|
|
|
#import <CocoaHTTPServer/HTTPMessage.h>
|
2018-11-16 01:40:02 -08:00
|
|
|
#import <CocoaHTTPServer/HTTPResponse.h>
|
|
|
|
|
#import <CocoaHTTPServer/HTTPErrorResponse.h>
|
2018-11-16 01:30:38 -08:00
|
|
|
|
|
|
|
|
#import "MBIMJSONDataResponse.h"
|
2018-11-13 12:29:15 -08:00
|
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
|
|
2018-11-16 01:40:02 -08:00
|
|
|
typedef void (^MBIMBridgeOperationCompletionBlock)(NSObject<HTTPResponse> * _Nullable response);
|
2018-11-16 01:30:38 -08:00
|
|
|
|
2018-11-13 12:29:15 -08:00
|
|
|
@interface MBIMBridgeOperation : NSOperation
|
|
|
|
|
@property (class, nonatomic, readonly) NSString *endpointName;
|
2021-07-06 22:52:33 -07:00
|
|
|
@property (class, nonatomic, readonly) BOOL requiresAuthentication; // default YES
|
2018-11-13 12:29:15 -08:00
|
|
|
|
2023-01-17 16:16:23 -08:00
|
|
|
@property (nonatomic, strong) HTTPMessage *request;
|
2018-11-16 01:30:38 -08:00
|
|
|
@property (nonatomic, strong) NSData *requestBodyData;
|
|
|
|
|
@property (nonatomic, readonly) NSURL *requestURL;
|
|
|
|
|
@property (nonatomic, readonly) MBIMBridgeOperationCompletionBlock serverCompletionBlock;
|
2018-11-13 12:29:15 -08:00
|
|
|
|
2018-11-21 15:51:51 -07:00
|
|
|
+ (dispatch_queue_t)sharedIMAccessQueue;
|
|
|
|
|
|
2018-11-13 12:29:15 -08:00
|
|
|
+ (nullable Class)operationClassForEndpointName:(NSString *)endpointName;
|
2018-11-16 01:30:38 -08:00
|
|
|
- (instancetype)initWithRequestURL:(NSURL *)requestURL completion:(MBIMBridgeOperationCompletionBlock)completionBlock;
|
2018-11-13 12:29:15 -08:00
|
|
|
|
2018-11-20 19:57:35 -07:00
|
|
|
- (NSObject<HTTPResponse> *)cancelAndReturnTimeoutResponse;
|
|
|
|
|
|
2018-11-21 15:51:51 -07:00
|
|
|
// convenience
|
|
|
|
|
- (nullable NSString *)valueForQueryItemWithName:(NSString *)queryItemName;
|
|
|
|
|
|
2018-11-13 12:29:15 -08:00
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_END
|