mirror of
https://github.com/samsonjs/samhuri.net-ios.git
synced 2026-03-25 09:25:47 +00:00
33 lines
1 KiB
Objective-C
33 lines
1 KiB
Objective-C
//
|
|
// JSONHTTPClient.h
|
|
// Blog
|
|
//
|
|
// Created by Sami Samhuri on 2014-11-23.
|
|
// Copyright (c) 2014 Guru Logic Inc. All rights reserved.
|
|
//
|
|
|
|
#import <Foundation/Foundation.h>
|
|
#import <PromiseKit/PromiseKit.h>
|
|
|
|
extern NSString *const JSONHTTPClientErrorDomain;
|
|
|
|
typedef enum : NSUInteger {
|
|
JSONHTTPClientErrorCodeWTF,
|
|
JSONHTTPClientErrorCodeInvalidResponse,
|
|
JSONHTTPClientErrorCodeRequestFailed
|
|
} JSONHTTPClientErrorCode;
|
|
|
|
@interface JSONHTTPClient : NSObject
|
|
|
|
@property (nonatomic, strong) NSDictionary *defaultHeaders;
|
|
|
|
- (instancetype)initWithSession:(NSURLSession *)session;
|
|
|
|
- (PMKPromise *)request:(NSURLRequest *)request;
|
|
- (PMKPromise *)get:(NSURL *)url headers:(NSDictionary *)headers;
|
|
- (PMKPromise *)putJSON:(NSURL *)url headers:(NSDictionary *)headers fields:(NSDictionary *)fields;
|
|
- (PMKPromise *)postJSON:(NSURL *)url headers:(NSDictionary *)headers fields:(NSDictionary *)fields;
|
|
- (PMKPromise *)post:(NSURL *)url headers:(NSDictionary *)headers;
|
|
- (PMKPromise *)delete:(NSURL *)url headers:(NSDictionary *)headers;
|
|
|
|
@end
|