CAIChannelService

public final class CAIChannelService : ObservableObject

This class allows you to communicate with all CAI channel-related HTTP APIs It implements ObservableObject to allow you to bind this object from your SwiftUI views

  • CAI Backend Service configuration

    Declaration

    Swift

    public let serviceConfig: CAIServiceConfig
  • Published. List of CAIChannel. Publishes new values when loadsChannels is called

    Declaration

    Swift

    @Published
    public var channels: [CAIChannel] { get set }
  • Undocumented

    Declaration

    Swift

    public init(config: CAIServiceConfig)
  • Loads all channels for a specific target system ID and assign the return of the Future into self.channels`. Ignores any errors.

    Declaration

    Swift

    public func loadChannels(for targetSystem: String)

    Parameters

    targetSystem

    String

  • Loads all channels for a specific target system ID and calls the completion handler to send the result

    Declaration

    Swift

    public func loadChannels(for targetSystem: String, _ completionHandler: @escaping (Result<[CAIChannel], URLError>) -> Void)

    Parameters

    targetSystem

    String

    completionHandler

    Handler function

  • Loads the preferences for a channel

    Declaration

    Swift

    public func loadPreferences(channel: CAIChannel, _ completionHandler: @escaping (Result<CAIChannelPreferencesData?, Error>) -> Void)

    Parameters

    channel

    CAIChannel

    completionHandler

    Handler function called when preferences are fetched