Structs
The following structs are available globally.
-
The options for a request. It captures headers, query-string and request body.
See moreDeclaration
Swift
public struct Options
-
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 theService
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
See moreResource
.Declaration
Swift
public struct Path<R: Resource, Path, Method>
-
This struct encodes the partial path to an operation on a remote resource or a collection. It has the same semantics as
Path
— encoding method etc. — but cannot be used to make a request. Instead it has to be appended to aPath
.Imagine we have a hierarchy like this:
/groups/{group_id}/users/{user_id}
. We don’t want to allow a path like/users/1
to be used to make a request. So we encode it as aChildPath
. We would turn it into a qualified path using the/(_:_:)
operator.Note: In general usage, you should not need to construct an instance of this type. Instead they are generated by functions defined on
See moreResource
.Declaration
Swift
public struct ChildPath<R: NestedResource, Path, Method>
-
A struct which wraps interaction with a remote API. It delegates all the HTTP requests to the underlying adapter.
See moreDeclaration
Swift
public struct Service<Adapter: HTTPAdapter>