MoltinRequest
public class MoltinRequest
Base class which various endpoints extend from. This class is responsible for orchestrating a request, by constructing queries, authenticating calls, and parsing data.
-
Initialise a new
MoltinRequest
with some standard configurationDeclaration
Swift
public init(withConfiguration configuration: MoltinConfig)
Parameters
withConfiguration
A
MoltinConfig
object
-
Add some includes to the query
Declaration
Swift
public func include(_ includes: [MoltinInclude]) -> Self
Parameters
includes
An array of
MoltinInclude
to append to the requestReturn Value
A instance of
MoltinRequest
which encapsulates the request. -
Add a limit parameter to the query
Declaration
Swift
public func limit(_ limit: Int) -> Self
Parameters
limit
The amount of items to return
Return Value
A instance of
MoltinRequest
which encapsulates the request. -
Add a sort parameter to the query
Declaration
Swift
public func sort(_ sort: String) -> Self
Parameters
sort
The sort order to use
Return Value
A instance of
MoltinRequest
which encapsulates the request. -
Add an offset parameter to the query
Declaration
Swift
public func offset(_ offset: Int) -> Self
Parameters
offset
The amount of items to offset by
Return Value
A instance of
MoltinRequest
which encapsulates the request. -
Add an filter parameter to the query
Declaration
Swift
public func filter(operator op: MoltinFilterOperator, key: String, value: String) -> Self
Parameters
operator
The
MoltinFilterOperator
to usekey
The key for the filter
value
The value for the filter
Return Value
A instance of
MoltinRequest
which encapsulates the request. -
Add a header to the request
Declaration
Swift
public func addHeader(_ key: String, withValue value: String) -> Self
Parameters
key
The header key
withValue
The header value
Return Value
An instance of
MoltinRequest
which encapsulates the request.