lms

package
v0.0.0-...-4c137d3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 17, 2021 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package lms provides common interfaces for different authentication methods for a Learning Management System.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthorizationMethods

type AuthorizationMethods struct {
	Token TokenAuthorization
}

AuthorizationMethods contains possible authorization methods supported by a service's implementation. Fields that are not nil are supported.

type Course

type Course struct {
	ID   CourseID
	Name string

	// Course dates.
	Start time.Time
	End   time.Time
}

Course describes a course.

type CourseID

type CourseID string

CourseID is the type for the course ID.

type Host

type Host string

Host describes the hostname of a LMS service. It is specifically used as a unique identifier among services.

type Name

type Name struct {
	First     string
	Last      string
	Preferred string
}

Name describes a name. If either First or Last is provided, then it is assumed that the field will contain the whole name (excluding Preferred).

func (Name) String

func (name Name) String() string

String formats the name into one string.

type Service

type Service interface {
	Authorize() AuthorizationMethods
}

Service describes an LMS service.

type Session

type Session interface {
	// User returns the current user.
	User() (*User, error)
	// Courses returns the list of courses that the current user is enrolled in.
	Courses() ([]Course, error)
}

Session describes an authorized session.

type TokenAuthorization

type TokenAuthorization interface {
	Authorize(token string) (Session, error)
}

TokenAuthorization is an authorization method which uses direct tokens.

type User

type User struct {
	ID     UserID
	Name   Name
	Avatar string // URL
}

User describes a user.

type UserID

type UserID string

UserID is the type for a user ID.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL