Path

public struct Path<R: Resource, Path, Method>

This struct encodes the path to an operation on a remote resource or a collection. It uses generics and phantom-types to encode the Resource it relates to, the response type — a collection or single resource — and the HTTP method.

It can then be passed to the call function on the Service type, which will execute the encoded operation.

Here is an example of a path for deleting a record:

let path = Path<User, SingularPath, DELETE>(path: "user/1")

Note: In general usage, you should not need to construct an instance of this type. Instead they are generated by functions defined on Resource.

  • The path to the resource collection e.g. users, posts.

    Declaration

    Swift

    public let path: String