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> where BaseRequestType: Request, PaginationType: PaginatedData, 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> : Publisher where RequestType : Request
-
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> : Publisher where StreamRequestType : StreamRequest