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.
-
The session’s unique ID. Matches the
UIDof the same event in the.icsexport.Declaration
Swift
var id: String -
“Y” if the session is active. Inactive sessions don’t appear in the
.icsexport.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
.icsCATEGORIES 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/exportJSON response.Declaration
Swift
static func decodeSessions(from buffer: ByteBuffer) throws -> [SchedSession] -
Converts the session to an
Event, matching whatEventParsermakes from the same session in the.icsexport (plus the age rating, which the.icsexport 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
.icsexport has: tags removed and runs of whitespace collapsed to a single space. Non-breaking spaces are kept, as the.icsexport keeps them.Declaration
Swift
static func plainText(fromHTML html: String) -> String
View on GitHub