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:) or JsonRequest.schedule(forPaginationWith:chunk:zeroBasedPageIndex:paginatedType:)).

    In contrast to the Response publisher, this instance is no publisher itself. The Paginator.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.

    See more

    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 a ConnectablePublisher 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 more

    Declaration

    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 additional send 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 type Result. Also note that the publisher never completes.

    Note that, in contrast to the Response publisher, this publisher does not replay any messages received.

    See more

    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 BackoffRetrier.Strategy). It also defines a maximum duration after which a failed request is deemed unsuccessful.

    See more

    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 more

    Declaration

    Swift

    public class CachingServiceHook : ServiceHook