-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathJSONAPI.h
More file actions
48 lines (36 loc) · 1.19 KB
/
Copy pathJSONAPI.h
File metadata and controls
48 lines (36 loc) · 1.19 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//
// JSONAPI.h
// JSONAPI
//
// Created by Josh Holtz on 12/23/13.
// Copyright (c) 2013 Josh Holtz. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "JSONAPIResource.h"
/**
* Represents a complete JSON-API formatted message body.
*/
@interface JSONAPI : NSObject
/**
* Returns Content-Type string for JSON-API
*
* @return Content-Type string for JSON-API
*/
+ (NSString*)MEDIA_TYPE;
@property (readonly) NSDictionary *meta;
@property (nonatomic, strong, readonly) NSArray *errors;
@property (readonly) id resource;
@property (nonatomic, strong, readonly) NSArray *resources;
@property (nonatomic, strong, readonly) NSDictionary *includedResources;
@property (nonatomic, strong, readonly) NSError *internalError;
// Initializers
+ (instancetype)jsonAPIWithDictionary:(NSDictionary *)dictionary;
+ (instancetype)jsonAPIWithString:(NSString *)string;
+ (instancetype)jsonAPIWithResource:(NSObject <JSONAPIResource> *)resource;
- (instancetype)initWithDictionary:(NSDictionary*)dictionary;
- (instancetype)initWithString:(NSString*)string;
- (NSDictionary*)dictionary;
- (NSDictionary*)allResources;
- (id)includedResource:(id)ID withType:(NSString*)type;
- (BOOL)hasErrors;
@end