Hiyve Components - v1.0.0
    Preparing search index...

    A CourseStorage kept in Hiyve user files.

    interface HiyveCourseStorage {
        userId: string;
        canWrite(): boolean;
        createCourse(course: Course): Promise<Course>;
        deleteCourse(courseId: string): Promise<void>;
        deleteLessonContent(courseId: string, lessonId: string): Promise<void>;
        enroll(courseId: string, client: ClientRef): Promise<Enrollment>;
        grantLessonAccess(
            enrollment: Enrollment,
            lessonIds: string[],
        ): Promise<void>;
        listCourses(): Promise<CourseSummary[]>;
        listEnrollmentOverviews(courseId: string): Promise<EnrollmentOverview[]>;
        listEnrollments(
            query?: { clientId?: string; courseId?: string },
        ): Promise<EnrollmentSummary[]>;
        listMyEnrollments(): Promise<EnrollmentSummary[]>;
        loadCourse(courseId: string): Promise<Course>;
        loadCourseKeys(courseId: string): Promise<CourseKeys | null>;
        loadEnrollment(enrollmentId: string): Promise<Enrollment>;
        loadLessonContent(
            courseId: string,
            lessonId: string,
        ): Promise<LessonContent | null>;
        loadProgress(enrollmentId: string): Promise<Progress | null>;
        loadProviderSettings(): Promise<ProviderSettings | null>;
        refresh(): Promise<void>;
        resolveMediaUrl(
            media: MediaRef,
            options?: { stream?: boolean },
        ): Promise<string>;
        revokeAccess(enrollment: Enrollment): Promise<void>;
        revokeLessonAccess(
            enrollment: Enrollment,
            lessonIds: string[],
        ): Promise<void>;
        saveCourse(course: Course): Promise<Course>;
        saveCourseKeys(keys: CourseKeys): Promise<CourseKeys>;
        saveEnrollment(enrollment: Enrollment): Promise<Enrollment>;
        saveLessonContent(content: LessonContent): Promise<LessonContent>;
        saveProgress(progress: Progress): Promise<Progress>;
        saveProviderSettings(settings: ProviderSettings): Promise<ProviderSettings>;
        subscribe?(listener: (change: CourseStorageChange) => void): () => void;
        uploadMedia(file: File): Promise<MediaRef>;
    }

    Hierarchy (View Summary)

    Index

    Properties

    userId: string

    The user this storage acts for.

    Methods

    • Whether saved documents can be changed now (a connected client is available).

      Returns boolean

    • Delete a course with its lessons, private answers and enrollments, and the files its lessons use that no other course uses.

      Parameters

      • courseId: string

      Returns Promise<void>

    • Delete a lesson's content (for example, a lesson added for one client that is no longer wanted).

      Parameters

      • courseId: string
      • lessonId: string

      Returns Promise<void>

    • Enroll a client: create their enrollment and let them read the course outline. Opens no lessons (see syncAccess). Enrolling a client who was removed reactivates their enrollment and reopens the lessons they had; enrolling an active client returns their enrollment unchanged.

      Parameters

      Returns Promise<Enrollment>

    • Let the enrolled client read these lessons' content and the files they use. Backends that decide access on the server can treat this as a no-op.

      Parameters

      Returns Promise<void>

    • An overview of every enrollment in one of this user's courses, including which lessons each client has completed — enough for progress tables, review queues and deciding what to open, without loading each client's progress. Implement it cheaply: it is called often.

      Parameters

      • courseId: string

      Returns Promise<EnrollmentOverview[]>

    • Enrollments in this user's courses, optionally for one course or one client.

      Parameters

      • Optionalquery: { clientId?: string; courseId?: string }

      Returns Promise<EnrollmentSummary[]>

    • A course outline.

      Parameters

      • courseId: string

      Returns Promise<Course>

    • The private quiz answers for a course, or null when none are saved.

      Parameters

      • courseId: string

      Returns Promise<CourseKeys | null>

    • A lesson's content, or null when it isn't open to this user or has no content yet.

      Parameters

      • courseId: string
      • lessonId: string

      Returns Promise<LessonContent | null>

    • A client's progress, or null when nothing has been saved yet.

      Parameters

      • enrollmentId: string

      Returns Promise<Progress | null>

    • Reload the list of files from the server.

      Returns Promise<void>

    • A URL to load a stored file from. stream asks for a URL suited to playback.

      Parameters

      • media: MediaRef
      • Optionaloptions: { stream?: boolean }

      Returns Promise<string>

    • Stop the client reading the course, its lessons, their files, the provider's review attachments and the enrollment.

      Parameters

      Returns Promise<void>

    • Take these lessons (and the files only they use) back from the client, for example when a rule closes again.

      Parameters

      Returns Promise<void>

    • Save changes to a course. Rejects with 'conflict' if it was saved elsewhere since it was loaded.

      Parameters

      Returns Promise<Course>

    • Save changes to an enrollment, merged with any copy saved from another device. Files attached to review comments become readable by the client.

      Parameters

      Returns Promise<Enrollment>

    • Save the client's progress, merged with any copy saved from another device. The provider can read it, including the files in the client's submissions and replies.

      Parameters

      Returns Promise<Progress>

    • Be told when something this user can see changes. Returns an unsubscribe function.

      Parameters

      Returns () => void

    • Store a file for a block or a course cover.

      Parameters

      • file: File

      Returns Promise<MediaRef>