From 005a981bf7021584345511643c44b5e13e3a75de Mon Sep 17 00:00:00 2001 From: Mathew Polzin Date: Wed, 5 Dec 2018 22:51:12 -0800 Subject: [PATCH] Add a couple of missing initializers to Entity --- Sources/JSONAPI/Resource/Entity.swift | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Sources/JSONAPI/Resource/Entity.swift b/Sources/JSONAPI/Resource/Entity.swift index fd290e5..595c0cb 100644 --- a/Sources/JSONAPI/Resource/Entity.swift +++ b/Sources/JSONAPI/Resource/Entity.swift @@ -326,6 +326,12 @@ extension Entity where MetaType == NoMetadata, EntityRawIdType: CreatableRawIdTy } } +extension Entity where MetaType == NoMetadata, EntityRawIdType == Unidentified { + public init(attributes: Description.Attributes, relationships: Description.Relationships, links: LinksType) { + self.init(attributes: attributes, relationships: relationships, meta: .none, links: links) + } +} + extension Entity where LinksType == NoLinks { public init(id: Entity.Id, attributes: Description.Attributes, relationships: Description.Relationships, meta: MetaType) { self.init(id: id, attributes: attributes, relationships: relationships, meta: meta, links: .none) @@ -338,6 +344,12 @@ extension Entity where LinksType == NoLinks, EntityRawIdType: CreatableRawIdType } } +extension Entity where LinksType == NoLinks, EntityRawIdType == Unidentified { + public init(attributes: Description.Attributes, relationships: Description.Relationships, meta: MetaType) { + self.init(attributes: attributes, relationships: relationships, meta: meta, links: .none) + } +} + extension Entity where MetaType == NoMetadata, LinksType == NoLinks { public init(id: Entity.Id, attributes: Description.Attributes, relationships: Description.Relationships) { self.init(id: id, attributes: attributes, relationships: relationships, meta: .none, links: .none) @@ -350,6 +362,12 @@ extension Entity where MetaType == NoMetadata, LinksType == NoLinks, EntityRawId } } +extension Entity where MetaType == NoMetadata, LinksType == NoLinks, EntityRawIdType == Unidentified { + public init(attributes: Description.Attributes, relationships: Description.Relationships) { + self.init(attributes: attributes, relationships: relationships, meta: .none, links: .none) + } +} + // MARK: Pointer for Relationships use. public extension Entity where EntityRawIdType: JSONAPI.RawIdType {