HistoryQuery

final class HistoryQuery

A query for history items.

  • Adds a filter for history items that originate from any of the given objects.

    Declaration

    Swift

    func objects(_ objects: any HomeObject...) -> Self
  • Adds a filter for history items that originate from any of the given objects.

    Declaration

    Swift

    func objects(_ objects: [any HomeObject]) -> Self
  • Adds a filter for history items that originate from any of the referenced objects.

    Declaration

    Swift

    func objects(_ objectIDs: String...) -> Self
  • Adds a filter for history items that originate from any of the referenced objects.

    Declaration

    Swift

    func objects(_ objectIDs: [String]) -> Self
  • Adds a filter for history items that occurred within the given date range.

    Declaration

    Swift

    func date(start: Date = .distantPast, end: Date = .distantFuture) -> Self

    Parameters

    start

    The start date of the date range. Defaults to .distantPast.

    end

    The end date of the date range. Defaults to .distantFuture.

  • Adds a filter for history items that belong to any of the given Trait types.

    Declaration

    Swift

    func traits(_ traits: any Trait.Type...) -> Self
  • Adds a filter for history items that belong to any of the given Event types.

    Declaration

    Swift

    func events(_ events: any Event.Type...) -> Self
  • Adds a filter for history items that belong to any of the given camera event types.

    Declaration

    Swift

    func cameraEvents(_ cameraEventTypes: String...) -> Self
  • Adds a filter expression for history items that match the given attribute.

    Declaration

    Swift

    func attribute(_ key: String, value: String) -> Self
  • Undocumented

    Declaration

    Swift

    var description: String { get }
  • Executes the query with the current filter spec.

    Parameter: pageSize - Number of items to return in a single page (max 1000). Returns an AsyncSequence of pages of items.s

    Declaration

    Swift

    func execute(pageSize: UInt) throws -> PagedHistoryStream
  • Executes the query with the current filter spec, collects results, and returns them as an array.

    Returns an array of all matched items.

    Declaration

    Swift

    func execute() async throws -> [HistoryItem]
  • A page of query results.

    Declaration

    Swift

    struct Paged<T> where T : Sendable
    extension HistoryQuery.Paged : Sendable