Documentation ¶
Index ¶
- func Code(err error) string
- type APIError
- type AdvancedFeatureEnabled
- type AuthAPI
- type Client
- type ClientOption
- type ClientOptions
- type Course
- type CourseAPI
- type CourseClassification
- type GradeAPI
- type GradeItem
- type GradeTable
- type GradeTableItem
- type GradeTableItemGroup
- type LoginResponse
- type Quiz
- type QuizAPI
- type QuizAttempt
- type QuizQuestion
- type SiteAPI
- type SiteFunctionVersion
- type SiteInfo
- type UserAPI
- type UserGrade
- type Warning
- type Warnings
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type APIError ¶
type APIError struct { Err *string `json:"error,omitempty"` Message *string `json:"message,omitempty"` ErrorCode string `json:"errorcode"` StackTrace *string `json:"stacktrace,omitempty"` Exception *string `json:"exception,omitempty"` DebugInfo *string `json:"debuginfo,omitempty"` ReproductionLink *string `json:"reproductionlink,omitempty"` }
type AdvancedFeatureEnabled ¶
type AuthAPI ¶
type AuthAPI interface {
Login(ctx context.Context, username, password string) (*LoginResponse, error)
}
type Client ¶
type Client struct { AuthAPI AuthAPI SiteAPI SiteAPI UserAPI UserAPI CourseAPI CourseAPI QuizAPI QuizAPI GradeAPI GradeAPI // contains filtered or unexported fields }
Client is a Moodle API client scoped to a service.
func NewClient ¶
func NewClient(ctx context.Context, serviceURL *url.URL, authToken string, opt ...ClientOption) (*Client, error)
NewClient creates a new Moodle client.
func NewClientWithLogin ¶
func NewClientWithLogin(ctx context.Context, serviceURL *url.URL, username, password string, opt ...ClientOption) (*Client, error)
NewClientWithLogin creates a new Moodle client with token retrieved from login request.
type ClientOption ¶
type ClientOption interface {
// contains filtered or unexported methods
}
ClientOption is a option to change client configuration.
func WithDebugEnabled ¶
func WithDebugEnabled() ClientOption
WithDebugEnabled enable debug logs this option is should be used in development only.
func WithHTTPClient ¶
func WithHTTPClient(httpClient *http.Client) ClientOption
type ClientOptions ¶
type Course ¶
type Course struct { ID int FullName string ShortName string Summary string SummaryFormat int StartDate time.Time EndDate time.Time Visible bool FullNameDisplay string ViewURL string CourseImage string Progress int HasProgress bool IsSavourite bool Hidden bool ShowShortName bool CourseCategory string }
type CourseAPI ¶
type CourseAPI interface {
GetEnrolledCoursesByTimelineClassification(ctx context.Context, classification CourseClassification) ([]*Course, error)
}
type CourseClassification ¶
type CourseClassification string
const ( CourseClassificationPast CourseClassification = "past" CourseClassificationInProgress CourseClassification = "inprogress" CourseClassificationFuture CourseClassification = "future" )
type GradeItem ¶
type GradeItem struct { ID int ItemName string ItemType string ItemModule *string ItemInstance int ItemNumber *int CategoryID *int OutcomeID *int ScaleID *int Locked *bool CmID int GradeRaw float64 GradeDateSubmitted *time.Time GradeDateGraded *time.Time GradeHiddenByDate bool GradeNeedsUpdate bool GradeIsHidden bool GradeIsLocked *bool GradeIsOverridden *bool GradeFormatted string GradeMin int GradeMax int RangeFormatted string Feedback string FeedbackFormat int }
GradeItem represents an grade If you want to know percentage of the grade out of course total grade, see GradeTableItem
type GradeTable ¶
type GradeTable struct { CourseID int UserID int UserFullname string MaxDepth int ItemGroups []*GradeTableItemGroup }
GradeTable represents a grade table for a course
type GradeTableItem ¶
type GradeTableItemGroup ¶
type GradeTableItemGroup struct { Name string Items []*GradeTableItem }
GradeTableItemGroup represents a group of grade items
type LoginResponse ¶
type Quiz ¶
type Quiz struct { ID int CourseID int CourseModuleID int Name string Intro string IntroFormat int TimeOpen time.Time TimeClose time.Time TimeLimit int PreferredBehaviour string Attempts int GradeMethod int DecimalPoints int QuestionDecimalPoints int SumGrades int Grade int HasFeedback int Section int Visible int GroupMode int GroupingID int }
type QuizAPI ¶
type QuizAPI interface { GetQuizzesByCourse(ctx context.Context, courseID int) ([]*Quiz, error) GetUserAttempts(ctx context.Context, quizID int) ([]*QuizAttempt, error) GetAttemptReview(ctx context.Context, attemptID int) (*QuizAttempt, []*QuizQuestion, error) StartAttempt(ctx context.Context, quizID int) (*QuizAttempt, error) FinishAttempt(ctx context.Context, attemptID int, timeUp bool) error }
type QuizAttempt ¶
type QuizQuestion ¶
type SiteFunctionVersion ¶
type SiteInfo ¶
type SiteInfo struct { SiteName string Username string Firstname string Lastname string Fullname string Lang string UserID int SiteURL string UserPictureURL string Functions []*SiteFunctionVersion DownloadFiles bool UploadFiles bool Release string Version string MobileCSSURL string AdvancedFeatures []*AdvancedFeatureEnabled UserCanManageOwnFiles bool UserQuota int UserMaxUploadFileSize int UserHomePage int SiteID int SiteCalendarType string UserCalendarType string Theme string }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.