Options
All
  • Public
  • Public/Protected
  • All
Menu

The utilities of this SDK.

For example, you can determine the course state with ExtractCourseState().

Index

Type aliases

TimeOffset

TimeOffset: string

Variables

timeOffsetPattern

timeOffsetPattern: RegExp = ...

Functions

ExtractCourseState

  • ExtractCourseState(course: { created_at: string; expire_time: string; google_classroom_id: string; id: number; late_time: string; name: string; start_timestamp: Date; teacher_id: number; updated_at: string; uuid: string }): CheckinState
  • Determine the current checkin ability state from the course response

    Parameters

    • course: { created_at: string; expire_time: string; google_classroom_id: string; id: number; late_time: string; name: string; start_timestamp: Date; teacher_id: number; updated_at: string; uuid: string }

      The course to be determined.

      • created_at: string
      • expire_time: string
      • google_classroom_id: string
      • id: number
      • late_time: string
      • name: string
      • start_timestamp: Date
      • teacher_id: number
      • updated_at: string
      • uuid: string

    Returns CheckinState

getAddedTime

  • getAddedTime(startTimestamp: Date, offset: string): dayjs.Dayjs
  • Get the Dayjs date object of (startTimestamp + TimePlus)

    Parameters

    • startTimestamp: Date

      The start time.

    • offset: string

      The offset to added.

    Returns dayjs.Dayjs

isAfter

  • isAfter(startTimestamp: Date, timePlus: string): boolean
  • Is the specified time in the future?

    Formula: (startTimestamp + timePlus) > Date.now()

    see

    getAddedTime

    Parameters

    • startTimestamp: Date
    • timePlus: string

    Returns boolean

isBefore

  • isBefore(startTimestamp: Date, timePlus: string): boolean
  • Is the specified time in the past?

    Formula: (startTimestamp + timePlus) < Date.now()

    see

    getAddedTime

    Parameters

    • startTimestamp: Date
    • timePlus: string

    Returns boolean

isTimeOffset

  • isTimeOffset(time: string): time is string
  • Is it the TimeOffset pattern.

    example
    isTimeOffset("00:10:00") // true
    isTimeOffset("0:0:0") // false
    isTimeOffset("1:13:15") // false
    isTimeOffset("01:13:15") // true

    Parameters

    • time: string

    Returns time is string

Generated using TypeDoc