2018-11-27 11:45:15 -08:00
|
|
|
//
|
|
|
|
|
// Relationship+Literal.swift
|
2019-01-13 18:35:20 -08:00
|
|
|
// JSONAPITesting
|
2018-11-27 11:45:15 -08:00
|
|
|
//
|
|
|
|
|
// Created by Mathew Polzin on 11/27/18.
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
import JSONAPI
|
|
|
|
|
|
2018-12-08 01:17:47 -08:00
|
|
|
extension ToOneRelationship: ExpressibleByNilLiteral where Identifiable.Identifier: ExpressibleByNilLiteral, MetaType == NoMetadata, LinksType == NoLinks {
|
2019-11-05 22:37:48 -08:00
|
|
|
public init(nilLiteral: ()) {
|
2018-11-29 11:31:17 -08:00
|
|
|
|
2019-11-05 22:37:48 -08:00
|
|
|
self.init(id: Identifiable.Identifier(nilLiteral: ()))
|
|
|
|
|
}
|
2018-11-27 11:45:15 -08:00
|
|
|
}
|
2018-11-27 23:59:12 -08:00
|
|
|
|
2018-12-08 01:17:47 -08:00
|
|
|
extension ToOneRelationship: ExpressibleByUnicodeScalarLiteral where Identifiable.Identifier: ExpressibleByUnicodeScalarLiteral, MetaType == NoMetadata, LinksType == NoLinks {
|
2019-11-05 22:37:48 -08:00
|
|
|
public typealias UnicodeScalarLiteralType = Identifiable.Identifier.UnicodeScalarLiteralType
|
2018-11-29 11:31:17 -08:00
|
|
|
|
2019-11-05 22:37:48 -08:00
|
|
|
public init(unicodeScalarLiteral value: UnicodeScalarLiteralType) {
|
|
|
|
|
self.init(id: Identifiable.Identifier(unicodeScalarLiteral: value))
|
|
|
|
|
}
|
2018-11-29 11:31:17 -08:00
|
|
|
}
|
|
|
|
|
|
2018-12-08 01:17:47 -08:00
|
|
|
extension ToOneRelationship: ExpressibleByExtendedGraphemeClusterLiteral where Identifiable.Identifier: ExpressibleByExtendedGraphemeClusterLiteral, MetaType == NoMetadata, LinksType == NoLinks {
|
2019-11-05 22:37:48 -08:00
|
|
|
public typealias ExtendedGraphemeClusterLiteralType = Identifiable.Identifier.ExtendedGraphemeClusterLiteralType
|
2018-11-29 11:31:17 -08:00
|
|
|
|
2019-11-05 22:37:48 -08:00
|
|
|
public init(extendedGraphemeClusterLiteral value: ExtendedGraphemeClusterLiteralType) {
|
|
|
|
|
self.init(id: Identifiable.Identifier(extendedGraphemeClusterLiteral: value))
|
|
|
|
|
}
|
2018-11-29 11:31:17 -08:00
|
|
|
}
|
|
|
|
|
|
2018-12-08 01:17:47 -08:00
|
|
|
extension ToOneRelationship: ExpressibleByStringLiteral where Identifiable.Identifier: ExpressibleByStringLiteral, MetaType == NoMetadata, LinksType == NoLinks {
|
2019-11-05 22:37:48 -08:00
|
|
|
public typealias StringLiteralType = Identifiable.Identifier.StringLiteralType
|
2018-11-29 11:31:17 -08:00
|
|
|
|
2019-11-05 22:37:48 -08:00
|
|
|
public init(stringLiteral value: StringLiteralType) {
|
|
|
|
|
self.init(id: Identifiable.Identifier(stringLiteral: value))
|
|
|
|
|
}
|
2018-11-29 11:31:17 -08:00
|
|
|
}
|
|
|
|
|
|
2018-12-05 09:14:38 -08:00
|
|
|
extension ToManyRelationship: ExpressibleByArrayLiteral where MetaType == NoMetadata, LinksType == NoLinks {
|
2019-11-05 22:37:48 -08:00
|
|
|
public typealias ArrayLiteralElement = Relatable.Identifier
|
2018-11-27 23:59:12 -08:00
|
|
|
|
2019-11-05 22:37:48 -08:00
|
|
|
public init(arrayLiteral elements: ArrayLiteralElement...) {
|
|
|
|
|
self.init(ids: elements)
|
|
|
|
|
}
|
2018-11-27 23:59:12 -08:00
|
|
|
}
|