HATypedRequest

public struct HATypedRequest<ResponseType> where ResponseType : HADataDecodable

A request which has a strongly-typed response format

  • Create a typed request

    Declaration

    Swift

    public init(request: HARequest)

    Parameters

    request

    The request to be issued

  • The request to be issued

    Declaration

    Swift

    public var request: HARequest
  • Retrieve the current user

    Declaration

    Swift

    static func currentUser() -> HATypedRequest<HAResponseCurrentUser>

    Return Value

    A typed request that can be sent via HAConnection

  • Call a service

    Note

    Parameters are ExpressibleByStringLiteral. You can use strings instead of using .init(rawValue:).

    Declaration

    Swift

    static func callService(
        domain: HAServicesDomain,
        service: HAServicesService,
        data: [String: Any] = [:]
    ) -> HATypedRequest<HAResponseVoid>

    Parameters

    domain

    The domain of the service, e.g. light

    service

    The service, e.g. turn_on

    data

    The service data

    Return Value

    A typed request that can be sent via HAConnection

  • Retrieve definition of all services

    Declaration

    Swift

    static func getServices() -> HATypedRequest<HAResponseServices>

    Return Value

    A typed request that can be sent via HAConnection

  • Send binary stream STT data

    Declaration

    Swift

    static func sendSttData(sttHandlerId: UInt8, audioDataBase64Encoded: String) -> HATypedRequest<HAResponseVoid>

    Parameters

    sttHandlerId

    Handler Id provided by run-start event from Assist pipeline

    audioDataBase64Encoded

    Audio data base 64 encoded

    Return Value

    A typed request that can be sent via HAConnection