HighlightReaderProtocol

public protocol HighlightReaderProtocol

A protocol that defines a reader of HighlightObjects

  • highlightsByGroup(_:) Asynchronous

    Returns all HighlightObjects with the given group

    Reads the highlight objects and returns the sorted list. The list is sorted by the dateRecorded desc, jerseyNumber asc

    Declaration

    Swift

    func highlightsByGroup(_ group: String?) async -> [HighlightObject]

    Parameters

    group

    group name or everything if nil. Pass the group to find all highlights created in a session.

  • Returns all HighlightObjects for a given video chunk name

    Reads the highlight objects and returns the sorted list. The list is sorted by the dateRecorded desc, jerseyNumber asc

    Declaration

    Swift

    func highlightsByChunkFile(_ file: String) async -> [HighlightObject]

    Parameters

    file

    video chunk file name. Pass the chunkName to find all highlights associated with this chunk.

  • Find the saved highlights by groups, jersey numbers and date range

    You can search highlights by groups or jersey numbers or combination of both (AND condition) and optionally filter by date range.

    Note

    If you want to find all highlights without jersey numbers then pass [nil] to jerseyNumbers. If you want all jersey numbers then pass nil to the parameter.

    Declaration

    Swift

    func highlightsBy(groups: [String]?, jerseyNumbers: [Int?]?, dateFrom: Date?, dateTo: Date?) async -> [HighlightObject]

    Return Value

    a list of HighlightObjects

  • Find a list of all known jersey numbers in the saved highlights for the given date range

    Searches all highlights in the given date range and returns a list of unique jersey numbers sorted in ascending order.

    Declaration

    Swift

    func availableJerseyNumbers(dateFrom: Date?, dateTo: Date?) async -> [JerseyNumberInfo]

    Return Value

    a list of unique jersey numbers and number of highlights for each, each JN is included only once

  • Find a list of all known groups in the saved highlights for the given date range

    Searches all highlights in the given date range and returns a list of unique groups sorted by date recorded in ascending order.

    Declaration

    Swift

    func availableGroups(dateFrom: Date?, dateTo: Date?) async -> [GroupInfo]

    Return Value

    a list of unique groups and number of highlights for each, each group is included only once

  • saveHighlights(_:) Asynchronous

    Save the given list of highlight objects into internal DB

    The method saves the given list of highlight objects into the internal DB to be later retrieved by the reader.

    Note

    The highlight should have the chunk file set and exist in the highlightsPath.

    Declaration

    Swift

    func saveHighlights(_ highlights: [HighlightObject]) async -> [HighlightObject]

    Parameters

    highlights

    a list of highlight objects to save

    Return Value

    a list of saved highlight objects or empty array if nothing is saved