SchedSession

struct SchedSession : Codable

One session (event) from the sched.com GET /api/session/export?format=json API. Only the fields Swiftarr uses are decoded.

Sched returns most values as strings. event_start and event_end are wall-clock times in the Sched site’s own timezone, which isn’t necessarily the ship’s; start_time_ts is the absolute start time.

  • id

    The session’s unique ID. Matches the UID of the same event in the .ics export.

    Declaration

    Swift

    var id: String
  • “Y” if the session is active. Inactive sessions don’t appear in the .ics export.

    Declaration

    Swift

    var active: String
  • Declaration

    Swift

    var name: String
  • “yyyy-MM-dd HH:mm” in the Sched site’s timezone.

    Declaration

    Swift

    var eventStart: String
  • “yyyy-MM-dd HH:mm” in the Sched site’s timezone.

    Declaration

    Swift

    var eventEnd: String
  • Unix timestamp of the session’s start.

    Declaration

    Swift

    var startTimeTS: Int
  • The session’s category, e.g. “Shadow Cruise”. Same as the .ics CATEGORIES value.

    Declaration

    Swift

    var eventType: String
  • Sched’s subtype. For JoCo this is the age rating, e.g. “Teens and Older”.

    Declaration

    Swift

    var eventSubtype: String?
  • HTML-formatted description.

    Declaration

    Swift

    var description: String?
  • Declaration

    Swift

    var venue: String?
  • The venue’s address, e.g. “Deck 3, Forward”.

    Declaration

    Swift

    var address: String?
  • Declaration

    Swift

    enum CodingKeys : String, CodingKey
  • Decodes a sched.com session/export JSON response.

    Declaration

    Swift

    static func decodeSessions(from buffer: ByteBuffer) throws -> [SchedSession]
  • Converts the session to an Event, matching what EventParser makes from the same session in the .ics export (plus the age rating, which the .ics export doesn’t have).

    Declaration

    Swift

    func makeEvent() throws -> Event?

    Return Value

    The Event, or nil if the session is inactive.

  • Parses a Sched wall-clock time (“yyyy-MM-dd HH:mm”, with or without seconds) as if it were GMT. Only useful for differences between two times, since the real timezone is the Sched site’s.

    Declaration

    Swift

    static func wallClockDate(_ value: String) -> Date?
  • Converts a Sched HTML description to the plain text the .ics export has: tags removed and runs of whitespace collapsed to a single space. Non-breaking spaces are kept, as the .ics export keeps them.

    Declaration

    Swift

    static func plainText(fromHTML html: String) -> String