SchedClient

struct SchedClient

Talks to the sched.com API for this cruise’s Sched site, using Settings.schedBaseUrl and Settings.schedApiKey.

Error messages never include request URLs, since they contain the API key.

  • Declaration

    Swift

    let client: any Client
  • The fields requested from role/export for speakers.

    Declaration

    Swift

    static let speakerFields: String
  • exportSessions() Asynchronous

    Gets every session on the schedule from the Sched API.

    Declaration

    Swift

    func exportSessions() async throws -> [SchedSession]
  • exportSpeakers() Asynchronous

    Gets every speaker from the Sched API.

    Declaration

    Swift

    func exportSpeakers() async throws -> [SchedSpeaker]
  • Decodes a sched.com API JSON response. Sched reports errors (such as a bad API key) as a plain-text ERR: ... body with a 200 status, so this checks for that before decoding.

    Declaration

    Swift

    static func decode<T>(_ type: T.Type, from buffer: ByteBuffer) throws -> T where T : Decodable
  • get(_:query:) Asynchronous

    GETs {schedBaseUrl}/api/{endpoint} with the API key and JSON format, plus any other query parameters.

    Declaration

    Swift

    private func get(_ endpoint: String, query: [String : String] = [:]) async throws -> ByteBuffer