protocol DiscoveryController : Sendable
Manages Discovery Candidates for all Structures in a User Account.
This protocol is used to manage the Discovery Candidates for all Structures in a User Account. This includes fetching, caching and freshing the candidates.
Note
This protocol exists to facilitate eventual SRL migration.-
Returns the Discovery candidates for the given Structure.
Note
Initially the Discovery API is non streaming. The expected usage is:
let candidates = try await discoveryController.candidates(for: structure, includeDescendants: false).first()
Declaration
Swift
func candidates(for structure: Structure, includeDescendants: Bool) -> any Query<AnyNodeCandidate>
Parameters
includeDescendants
Whether to include candidates for all the objects within the specified Structure.
Return Value
The Discovery candidates for the given Structure.
-
Returns the Discovery candidates for the given Device.
Note
Initially the Discovery API is non streaming. The expected usage is:
let candidates = try await discoveryController.candidates(for: device).first()
Declaration
Swift
func candidates(for device: HomeDevice) throws -> any Query<AnyNodeCandidate>
Return Value
The Discovery candidates for the given home object.
-
Refreshes the Discovery candidates for the given structure ID.
Note
This method will fetch the candidates, cache them, and publish the updated results on all the existing publishers for the given structure.
Declaration
Swift
func refresh(structureID: String) async throws
Parameters
structureID
The structure ID to refresh the candidates for.