Resource
public protocol Resource
Defines the base requirements for types that interact with Yopuy.
Note: This protocol should not be used directly, instead use the
RootResource
, ChildResource
, SingularRootResource
or
SingularChildResource
protocols.
-
A getter for the string that represents a resource’s collection e.g.
"users"
or"posts"
. It should only be a partial path. It must not include the host or refer to parent resources.Declaration
Swift
static var path: String
-
The expected return type when parsing a single resource. This is explict rather than defaulting to
Self
so that custom wrapper types can be specified if required.Declaration
Swift
associatedtype Singular
-
A static function required for parsing a single resource. The
Data
is the result from a call to the network.Declaration
Swift
static func parse(singular data: Data) throws -> Singular