Add access to easy optional access to entire data on Document.Body

This commit is contained in:
Mathew Polzin
2018-12-12 20:05:29 -08:00
parent bb1ed30e89
commit 3b7ef4aeb9
+5
View File
@@ -66,6 +66,11 @@ public struct Document<PrimaryResourceBody: JSONAPI.ResourceBody, MetaType: JSON
guard case let .errors(errors, meta: _, links: _) = self else { return nil }
return errors
}
public var data: Data? {
guard case let .data(data) = self else { return nil }
return data
}
public var primaryResource: PrimaryResourceBody? {
guard case let .data(data) = self else { return nil }