Classes
The following classes are available globally.
-
A paginator is returned whenever a request is scheduled for pagination (see
Request.schedule(forPaginationWith:chunk:zeroBasedPageIndex:decode:)
orJsonRequest.schedule(forPaginationWith:chunk:zeroBasedPageIndex:paginatedType:)
).In contrast to the
See moreResponse
publisher, this instance is no publisher itself. ThePaginator.connect(with:)
needs to be called which yields a publisher that emits the responses for successive pagination requests. See the method’s documentation for details.Declaration
Swift
public class Paginator<BaseRequestType, PaginationType, ServiceType> where BaseRequestType: Request, PaginationType: PaginatedData, ServiceType: HttpService, PaginationType.DataType == BaseRequestType.Result
-
An instance of the response class is returned whenever a
Request
is scheduled. The response is aConnectablePublisher
with the request’s result type as output. In the future, the set of available properties and methods on an instance of the response may be extended.As there is only a single response no matter the number of subscribers, the response is represented as a class (i.e. it is a shared publisher). Note that the actual scheduling of the request is performed upon the first subscription. Subscribers that subscribe at a later point in time receive the result as soon as it is available and do not send the request again.
Lastly, the class cannot be initialized by the user but is only returned by Squid upon scheduling a request.
See moreDeclaration
Swift
public class Response<RequestType, ServiceType>: Publisher where RequestType: Request, ServiceType: HttpService
-
An instance of the stream class is returned whenever a
StreamRequest
is scheduled. The stream publisher produces arbitrarily many values (depending on the messages from the connected peer). The publisher also provides additionalsend
methods to enable bidirectional communication. Note that publisher only errors out if the stream fails and continues to exist if single messages from the peer cause an error. This is the reason for the stream’s output to be of the typeResult
. Also note that the publisher never completes.Note that, in contrast to the
See moreResponse
publisher, this publisher does not replay any messages received.Declaration
Swift
public class Stream<StreamRequestType, ServiceType>: Publisher where StreamRequestType: StreamRequest, ServiceType: HttpService
-
The backoff retrier is a more complex, stateful retrier that retries a request upon certain failures by waiting a specified period of time defined by its strategy (see
See moreBackoffRetrier.Strategy
). It also defines a maximum duration after which a failed request is deemed unsuccessful.Declaration
Swift
public class BackoffRetrier : Retrier
-
The caching service hook caches a server’s response for requests for a specified time and prevents requests from being sent again if they can be served from the cache. Caching is only performed for GET requests as for all other requests, side-effects on the server are assumed.
See moreDeclaration
Swift
public class CachingServiceHook : ServiceHook