CalendarRoutes provides routes for processing conference data into calendar events.

const conferenceRepo: ConferenceRepository
const url: UrlService
const attendanceRepo: AttendanceRepository

const app = express().use(express.json())

const calendarRoutes = new CalendarRoutes({
conferenceRepo,
url,
attendanceRepo,
})

Todo

Update to use express-based examples

Hierarchy

  • CalendarRoutes

Constructors

Methods

  • createUserCalendar generates a URL for a user's personal calendar, the endpoint should be served by getUserIcs.

    const url = calendarRoutes.createUserCalendar()
    

    Parameters

    • authToken: null | AuthToken
    • getCalendarUrl: ((token: string) => URL)
        • (token: string): URL
        • Parameters

          • token: string

          Returns URL

    Returns PrivateCalendar

  • getGoogleCalendarUrl generates a URL to add a Session to a visitor's Google Calendar. Redirect the visitor to the returned URL so they can add the session to their calendar.

    const url = await calendarRoutes.getGoogleCalendarUrl('en', 'session-a')
    

    Potential errors:

    • general.notFound — if the session is not found or is not scheduled

    Parameters

    • locale: string
    • sessionId: string

    Returns Promise<URL>

  • getSessionIcsFile returns a translated ics file from a Session. It returns a string which is the contents of the ics file.

    const file = await calendarRoutes.getSessionIcsFile('en', 'session-a')
    

    Set these headers for it to download nicely:

    • Content-Type: text/calendar
    • Content-Disposition: attachment; filename="{session_id}.ics — where session_id is the id of the session being downloaded

    Potential errors:

    • general.notFound — if the session is not found or is not scheduled
    • general.internalServerError — if there was an unknown error generating the ics.

    Parameters

    Returns Promise<string>

  • getUserIcs generates an ICS file with all sessions a visitor is attending. see getSessionIcsFile for the best headers to set.

    const file = await calendarRoutes.getSessionIcsFile(icalToken)
    

    Potential errors:

    • general.unauthorized — if icalToken is not passed, it should be validated elsewhere.
    • general.internalServerError — if there was an unknown error generating the ics.

    Parameters

    Returns Promise<string>

Generated using TypeDoc