AnyStreamRequest

public struct AnyStreamRequest<ServiceType> : StreamRequest where ServiceType : HttpService

This struct can be used to construct stream requests easily without having to define a custom entity conforming to the StreamRequest protocol and defining some HttpService. The specifics of this entity are very similar to the specifics of AnyRequest. Note, however, that this entity restricts messages being sent and received to be of type String.

Types

  • Declaration

    Swift

    public typealias Message = String
  • Declaration

    Swift

    public typealias Result = String

Properties

Initialization

  • Initializes a new stream request based on a predefined HttpService.

    Declaration

    Swift

    public init(routes: HttpRoute,
                query: HttpQuery = [:],
                url: UrlConvertible? = nil,
                priority: RequestPriority = .default,
                service: ServiceType)

    Parameters

    routes

    The routing paths for the request. The final URL is constructed by making use of the given service.

    query

    The request’s query parameters. Defaults to no parameters.

    priority

    The priority of the request. Defaults to .default.

    service

    The service representing an API.

Instance Methods

  • Schedules the request and, as expected, returns a Stream publisher. As the service is transparently constructed when initializing the request, there is no need to pass a service in this case. This implies that the user should not use the schedule(with:) method.

    Declaration

    Swift

    public func schedule() -> Stream<`Self`, ServiceType>

Available where ServiceType == AnyHttpService

  • Initializes a new stream request for a particular URL.

    Declaration

    Swift

    public init(url: UrlConvertible,
                query: HttpQuery = [:],
                priority: RequestPriority = .default)

    Parameters

    url

    The URL of the request.

    query

    The request’s query parameters. Defaults to no parameters.

    priority

    The priority of the request. Defaults to .default.