- Abstracts API request.
- Manages global stream.
- Rx-based reactive architecture.
- Easy to mock.
- Protocol oriented.
- Defines structure of response.
- Single element, array element and empty response are supported.
See also: SingleResponse, ArrayResponse, EmptyResponse
Type of element in response.
Actual element of response.
Initializes response from API response JSON.
- json: Any
- JSON dictionary or array returned by API
- Conforms to
ResponseDefinition
. - Means the response contains simgle element of
T
. - Type of
result
isT
.
- Conforms to
ResponseDefinition
- Means the response contains multiple element of
T
- Type of
result
is[T]
- Conforms to
ResponseDefinition
- Means the response does not contain any element.
- Type of
result
isVoid
.
- Defines API endpoints.
- Equivalent to API documentation.
Indicates type of API response.
Ex:
typealias Response = ArrayResponse<User>
Path of endpoint.
Ex:
static var path: String = "/user/following"
This property is used to switch environment partially. Default value is .production
.
If you want to use other environment with only specific endpoint, you can override this property with value .mock
or .staging
.
Parameters to use in request. Default value is [:]
.
Method to use in request.
Namespace to define endpoints which conforms to EndpointDefinition
.
Creates request object for APIKit with EndpointDefinition
.
You do not have to create GenericRequest object manually.
Defines interface for higher-layer components such as ViewModels.