From e91a03b3964b9dbd196bd895aa28bc372c646004 Mon Sep 17 00:00:00 2001 From: Mathew Polzin Date: Thu, 29 Nov 2018 13:37:06 -0800 Subject: [PATCH] Expose initializer for Document.Body.Data --- Sources/JSONAPI/Document/Document.swift | 7 +++++++ Sources/JSONAPI/Document/ResourceBody.swift | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Sources/JSONAPI/Document/Document.swift b/Sources/JSONAPI/Document/Document.swift index f90f5f3..1949c29 100644 --- a/Sources/JSONAPI/Document/Document.swift +++ b/Sources/JSONAPI/Document/Document.swift @@ -39,6 +39,13 @@ public struct Document public let meta: MetaType public let links: LinksType + + public init(primary: PrimaryResourceBody, includes: Includes, meta: MetaType, links: LinksType) { + self.primary = primary + self.includes = includes + self.meta = meta + self.links = links + } } public var isError: Bool { diff --git a/Sources/JSONAPI/Document/ResourceBody.swift b/Sources/JSONAPI/Document/ResourceBody.swift index cace1c0..c87870a 100644 --- a/Sources/JSONAPI/Document/ResourceBody.swift +++ b/Sources/JSONAPI/Document/ResourceBody.swift @@ -32,7 +32,7 @@ public struct NoResourceBody: ResourceBody { public static var none: NoResourceBody { return NoResourceBody() } } -// MARK: Decodable +// MARK: Codable extension SingleResourceBody { public init(from decoder: Decoder) throws { let container = try decoder.singleValueContainer()