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()