Documentation
¶
Index ¶
- Variables
- func CreateBookmark(b *Bookmark) error
- func DeleteBookmark(b *Bookmark) error
- func IsRateLimit(e error) bool
- func SetHost(host string) error
- func SetToken(token string)
- func Todos() error
- type Account
- type AuthError
- type Avatar
- type Bookmark
- type CalendarEvent
- type Canvas
- func (c *Canvas) Accounts(opts ...Option) ([]Account, error)
- func (c *Canvas) ActiveCourses(opts ...Option) ([]*Course, error)
- func (c *Canvas) Announcements(contextCodes []string, opts ...Option) (arr []DiscussionTopic, err error)
- func (c *Canvas) Bookmarks(opts ...Option) (b []Bookmark, err error)
- func (c *Canvas) CalendarEvents(opts ...Option) (cal []CalendarEvent, err error)
- func (c *Canvas) CompletedCourses(opts ...Option) ([]*Course, error)
- func (c *Canvas) Conversations(opts ...Option) (conversations []Conversation, err error)
- func (c *Canvas) CourseAccounts(opts ...Option) ([]Account, error)
- func (c *Canvas) Courses(opts ...Option) ([]*Course, error)
- func (c *Canvas) CreateBookmark(b *Bookmark) error
- func (c *Canvas) CurrentAccount() (a *Account, err error)
- func (c *Canvas) CurrentUser(opts ...Option) (*User, error)
- func (c *Canvas) DeleteBookmark(b *Bookmark) error
- func (c *Canvas) GetCourse(id int, opts ...Option) (*Course, error)
- func (c *Canvas) GetUser(id int, opts ...Option) (*User, error)
- func (c *Canvas) SearchAccounts(opts ...Option) ([]Account, error)
- func (c *Canvas) SetHost(host string) error
- func (c *Canvas) Todos() error
- type Conversation
- type Course
- func (c *Course) Activity() (interface{}, error)
- func (c *Course) File(id int, opts ...Option) (*File, error)
- func (c *Course) Files(opts ...Option) <-chan *File
- func (c *Course) FilesErrChan() (<-chan *File, <-chan error)
- func (c *Course) Folder(id int, opts ...Option) (*Folder, error)
- func (c *Course) Folders(opts ...Option) <-chan *Folder
- func (c *Course) FoldersErrChan() (<-chan *Folder, <-chan error)
- func (c *Course) ListFiles(opts ...Option) ([]*File, error)
- func (c *Course) ListFolders(opts ...Option) ([]*Folder, error)
- func (c *Course) Quiz(id int, opts ...Option) (*Quiz, error)
- func (c *Course) Quizzes(opts ...Option) ([]*Quiz, error)
- func (c *Course) SearchUsers(term string, opts ...Option) (users []User, err error)
- func (c *Course) SetErrorHandler(f func(error, chan int))
- func (c *Course) Settings(opts ...Option) (cs *CourseSettings, err error)
- func (c *Course) UpdateSettings(settings *CourseSettings) (*CourseSettings, error)
- func (c *Course) User(id int, opts ...Option) (*User, error)
- func (c *Course) Users(opts ...Option) (users []User, err error)
- type CourseProgress
- type CourseSettings
- type DiscussionTopic
- type Enrollment
- type Error
- type File
- type Folder
- type Option
- func ArrayOpt(key string, vals ...string) Option
- func ContentType(contentTypes ...string) Option
- func DateOpt(key string, date time.Time) Option
- func IncludeOpt(vals ...string) Option
- func Opt(key string, val interface{}) Option
- func SortOpt(schemes ...string) Option
- func UserOpt(key, val string) Option
- type Quiz
- type QuizPermissions
- type Submission
- type Term
- type User
- func (u *User) Avatars() (av []Avatar, err error)
- func (u *User) Bookmarks(opts ...Option) (bks []Bookmark, err error)
- func (u *User) CalendarEvents(opts ...Option) (cal []CalendarEvent, err error)
- func (u *User) Color(asset string) (color *UserColor, err error)
- func (u *User) Colors() (map[string]string, error)
- func (u *User) Courses(opts ...Option) ([]*Course, error)
- func (u *User) CreateBookmark(b *Bookmark) error
- func (u *User) DeleteBookmark(b *Bookmark) error
- func (u *User) GradedSubmissions() (subs []*Submission, err error)
- func (u *User) Profile() (p *UserProfile, err error)
- func (u *User) SetColor(asset, hexcode string) error
- func (u *User) Settings() (settings map[string]interface{}, err error)
- type UserColor
- type UserProfile
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultHost is the default url host for the canvas api. DefaultHost = "canvas.instructure.com" // ConcurrentErrorHandler is the error handling callback for // handling errors in tricky goroutines. ConcurrentErrorHandler func(error, chan int) = defaultErrorHandler // DefaultUserAgent is the default user agent used to make requests. DefaultUserAgent = "go-canvas" )
var ErrRateLimitExceeded = errors.New("403 Forbidden (Rate Limit Exceeded)")
ErrRateLimitExceeded is returned when the api rate limit has been reached.
Functions ¶
func CreateBookmark ¶
CreateBookmark will take a bookmark and send it to canvas.
func IsRateLimit ¶
IsRateLimit returns true if the error given is a rate limit error.
Types ¶
type Account ¶
type Account struct {
ID int `json:"id"`
Name string `json:"name"`
UUID string `json:"uuid"`
ParentAccountID int `json:"parent_account_id"`
RootAccountID int `json:"root_account_id"`
WorkflowState string `json:"workflow_state"`
DefaultTimeZone string `json:"default_time_zone"`
IntegrationID string `json:"integration_id"`
SisAccountID string `json:"sis_account_id"`
SisImportID int `json:"sis_import_id"`
LtiGUID string `json:"lti_guid"`
// Storage Quotas
DefaultStorageQuotaMB int `json:"default_storage_quota_mb"`
DefaultUserStorageQuotaMB int `json:"default_user_storage_quota_mb"`
DefaultGroupStorageQuotaMB int `json:"default_group_storage_quota_mb"`
Domain string `json:"domain"`
Distance interface{} `json:"distance"`
// Authentication Provider
AuthProvider string `json:"authentication_provider"`
// contains filtered or unexported fields
}
Account is an account
func CourseAccounts ¶
CourseAccounts will make a call to the course accounts endpoint
func CurrentAccount ¶
CurrentAccount will get the current account.
func SearchAccounts ¶
SearchAccounts will search for canvas accounts. Options: name, domain, latitude, longitude
c.SearchAccouts(Opt("name", "My School Name"))
type AuthError ¶
type AuthError struct {
Status string `json:"status"`
Errors []errorMsg `json:"errors"`
}
AuthError is an authentication error response from canvas.
type Avatar ¶
type Avatar struct {
ID int `json:"id"`
Type string `json:"type"`
DisplayName string `json:"display_name"`
Filename string `json:"filename"`
URL string `json:"url"`
Token string `json:"token"`
ContentType string `json:"content-type"`
Size int `json:"size"`
}
Avatar is the avatar data for a user.
type Bookmark ¶
type Bookmark struct {
ID int `json:"id"`
Name string `json:"name"`
URL string `json:"url"`
Position int `json:"position"`
Data struct {
ActiveTab int `json:"active_tab"`
} `json:"data"`
}
Bookmark is a bookmark object.
type CalendarEvent ¶
type CalendarEvent struct {
// ID int `json:"id"`
ID string `json:"id"`
Title string `json:"title"`
StartAt string `json:"start_at"`
EndAt string `json:"end_at"`
Description string `json:"description"`
LocationName string `json:"location_name"`
LocationAddress string `json:"location_address"`
ContextCode string `json:"context_code"`
EffectiveContextCode interface{} `json:"effective_context_code"`
AllContextCodes string `json:"all_context_codes"`
WorkflowState string `json:"workflow_state"`
Hidden bool `json:"hidden"`
ParentEventID interface{} `json:"parent_event_id"`
ChildEventsCount int `json:"child_events_count"`
ChildEvents interface{} `json:"child_events"`
URL string `json:"url"`
HTMLURL string `json:"html_url"`
AllDayDate string `json:"all_day_date"`
AllDay bool `json:"all_day"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
AppointmentGroupID interface{} `json:"appointment_group_id"`
AppointmentGroupURL interface{} `json:"appointment_group_url"`
OwnReservation bool `json:"own_reservation"`
ReserveURL string `json:"reserve_url"`
Reserved bool `json:"reserved"`
ParticipantType string `json:"participant_type"`
ParticipantsPerAppointment interface{} `json:"participants_per_appointment"`
AvailableSlots interface{} `json:"available_slots"`
User *User `json:"user"`
Group interface{} `json:"group"`
}
CalendarEvent is a calendar event
func CalendarEvents ¶
func CalendarEvents(opts ...Option) ([]CalendarEvent, error)
CalendarEvents makes a call to get calendar events.
type Canvas ¶
type Canvas struct {
// contains filtered or unexported fields
}
Canvas is the main api controller.
func (*Canvas) ActiveCourses ¶
ActiveCourses returns a list of only the courses that are currently active
func (*Canvas) Announcements ¶
func (c *Canvas) Announcements(contextCodes []string, opts ...Option) (arr []DiscussionTopic, err error)
Announcements will get the announcements
func (*Canvas) CalendarEvents ¶
func (c *Canvas) CalendarEvents(opts ...Option) (cal []CalendarEvent, err error)
CalendarEvents makes a call to get calendar events.
func (*Canvas) CompletedCourses ¶
CompletedCourses returns a list of only the courses that are not currently active and have been completed
func (*Canvas) Conversations ¶
func (c *Canvas) Conversations(opts ...Option) (conversations []Conversation, err error)
Conversations returns a list of conversations
func (*Canvas) CourseAccounts ¶
CourseAccounts will make a call to the course accounts endpoint
func (*Canvas) CreateBookmark ¶
CreateBookmark will take a bookmark and send it to canvas.
func (*Canvas) CurrentAccount ¶
CurrentAccount will get the current account.
func (*Canvas) CurrentUser ¶
CurrentUser get the currently logged in user.
func (*Canvas) DeleteBookmark ¶
DeleteBookmark will delete a bookmark
func (*Canvas) SearchAccounts ¶
SearchAccounts will search for canvas accounts. Options: name, domain, latitude, longitude
c.SearchAccouts(Opt("name", "My School Name"))
type Conversation ¶
type Conversation struct {
ID int `json:"id"`
Subject string `json:"subject"`
WorkflowState string `json:"workflow_state"`
LastMessage string `json:"last_message"`
StartAt time.Time `json:"start_at"`
MessageCount int `json:"message_count"`
Subscribed bool `json:"subscribed"`
Private bool `json:"private"`
Starred bool `json:"starred"`
Properties interface{} `json:"properties"`
Audience interface{} `json:"audience"`
AudienceContexts interface{} `json:"audience_contexts"`
AvatarURL string `json:"avatar_url"`
Participants interface{} `json:"participants"`
Visible bool `json:"visible"`
ContextName string `json:"context_name"`
}
Conversation is a conversation.
func Conversations ¶
func Conversations(opts ...Option) ([]Conversation, error)
Conversations returns a list of conversations
type Course ¶
type Course struct {
ID int `json:"id"`
Name string `json:"name"`
SisCourseID int `json:"sis_course_id"`
UUID string `json:"uuid"`
IntegrationID interface{} `json:"integration_id"`
SisImportID int `json:"sis_import_id"`
CourseCode string `json:"course_code"`
WorkflowState string `json:"workflow_state"`
AccountID int `json:"account_id"`
RootAccountID int `json:"root_account_id"`
EnrollmentTermID int `json:"enrollment_term_id"`
GradingStandardID int `json:"grading_standard_id"`
GradePassbackSetting string `json:"grade_passback_setting"`
CreatedAt time.Time `json:"created_at"`
StartAt time.Time `json:"start_at"`
EndAt time.Time `json:"end_at"`
Locale string `json:"locale"`
Enrollments []struct {
EnrollmentState string `json:"enrollment_state"`
Role string `json:"role"`
RoleID int64 `json:"role_id"`
Type string `json:"type"`
UserID int64 `json:"user_id"`
LimitPrivilegesToCourseSection bool `json:"limit_privileges_to_course_section"`
} `json:"enrollments"`
TotalStudents int `json:"total_students"`
Calendar interface{} `json:"calendar"`
DefaultView string `json:"default_view"`
SyllabusBody string `json:"syllabus_body"`
NeedsGradingCount int `json:"needs_grading_count"`
Term Term `json:"term"`
CourseProgress CourseProgress `json:"course_progress"`
ApplyAssignmentGroupWeights bool `json:"apply_assignment_group_weights"`
Permissions struct {
CreateDiscussionTopic bool `json:"create_discussion_topic"`
CreateAnnouncement bool `json:"create_announcement"`
} `json:"permissions"`
IsPublic bool `json:"is_public"`
IsPublicToAuthUsers bool `json:"is_public_to_auth_users"`
PublicSyllabus bool `json:"public_syllabus"`
PublicSyllabusToAuth bool `json:"public_syllabus_to_auth"`
PublicDescription string `json:"public_description"`
StorageQuotaMb int `json:"storage_quota_mb"`
StorageQuotaUsedMb int `json:"storage_quota_used_mb"`
HideFinalGrades bool `json:"hide_final_grades"`
License string `json:"license"`
AllowStudentAssignmentEdits bool `json:"allow_student_assignment_edits"`
AllowWikiComments bool `json:"allow_wiki_comments"`
AllowStudentForumAttachments bool `json:"allow_student_forum_attachments"`
OpenEnrollment bool `json:"open_enrollment"`
SelfEnrollment bool `json:"self_enrollment"`
RestrictEnrollmentsToCourseDates bool `json:"restrict_enrollments_to_course_dates"`
CourseFormat string `json:"course_format"`
AccessRestrictedByDate bool `json:"access_restricted_by_date"`
TimeZone string `json:"time_zone"`
Blueprint bool `json:"blueprint"`
BlueprintRestrictions struct {
Content bool `json:"content"`
Points bool `json:"points"`
DueDates bool `json:"due_dates"`
AvailabilityDates bool `json:"availability_dates"`
} `json:"blueprint_restrictions"`
BlueprintRestrictionsByObjectType struct {
Assignment struct {
Content bool `json:"content"`
Points bool `json:"points"`
} `json:"assignment"`
WikiPage struct {
Content bool `json:"content"`
} `json:"wiki_page"`
} `json:"blueprint_restrictions_by_object_type"`
// contains filtered or unexported fields
}
Course represents a canvas course.
func ActiveCourses ¶
ActiveCourses returns a list of only the courses that are currently active
func CompletedCourses ¶
CompletedCourses returns a list of only the courses that are not currently active and have been completed
func (*Course) FilesErrChan ¶
FilesErrChan will return a channel that sends File structs and a channel that sends errors.
func (*Course) FoldersErrChan ¶
FoldersErrChan will return a channel for receiving folders and one for errors.
func (*Course) ListFolders ¶
ListFolders returns a slice of folders for the course.
func (*Course) SearchUsers ¶
SearchUsers will search for a user in the course
func (*Course) SetErrorHandler ¶
SetErrorHandler will set a error handling callback that is used to handle errors in goroutines. The default error handler will simply panic.
The callback should accept an error and a quit channel. If a value is sent on the quit channel, whatever secsion of code is receiving the channel will end gracefully.
func (*Course) Settings ¶
func (c *Course) Settings(opts ...Option) (cs *CourseSettings, err error)
Settings gets the course settings
func (*Course) UpdateSettings ¶
func (c *Course) UpdateSettings(settings *CourseSettings) (*CourseSettings, error)
UpdateSettings will update a user's settings based on a given settings struct and will return the updated settings struct.
type CourseProgress ¶
type CourseProgress struct {
RequirementCount int `json:"requirement_count"`
RequirementCompletedCount int `json:"requirement_completed_count"`
NextRequirementURL string `json:"next_requirement_url"`
CompletedAt string `json:"completed_at"`
}
CourseProgress is the progress through a course.
type CourseSettings ¶
type CourseSettings struct {
AllowStudentDiscussionTopics bool `json:"allow_student_discussion_topics"`
AllowStudentForumAttachments bool `json:"allow_student_forum_attachments"`
AllowStudentDiscussionEditing bool `json:"allow_student_discussion_editing"`
GradingStandardEnabled bool `json:"grading_standard_enabled"`
GradingStandardID int `json:"grading_standard_id"`
AllowStudentOrganizedGroups bool `json:"allow_student_organized_groups"`
HideFinalGrades bool `json:"hide_final_grades"`
HideDistributionGraphs bool `json:"hide_distribution_graphs"`
LockAllAnnouncements bool `json:"lock_all_announcements"`
UsageRightsRequired bool `json:"usage_rights_required"`
}
CourseSettings is a json struct for a course's settings.
type DiscussionTopic ¶
type DiscussionTopic struct {
ID int `json:"id"`
Title string `json:"title"`
Message string `json:"message"`
HTMLURL string `json:"html_url"`
PostedAt time.Time `json:"posted_at"`
LastReplyAt time.Time `json:"last_reply_at"`
RequireInitialPost bool `json:"require_initial_post"`
UserCanSeePosts bool `json:"user_can_see_posts"`
DiscussionSubentryCount int `json:"discussion_subentry_count"`
ReadState string `json:"read_state"`
UnreadCount int `json:"unread_count"`
Subscribed bool `json:"subscribed"`
SubscriptionHold string `json:"subscription_hold"`
AssignmentID interface{} `json:"assignment_id"`
DelayedPostAt interface{} `json:"delayed_post_at"`
Published bool `json:"published"`
LockAt interface{} `json:"lock_at"`
Locked bool `json:"locked"`
Pinned bool `json:"pinned"`
LockedForUser bool `json:"locked_for_user"`
LockInfo interface{} `json:"lock_info"`
LockExplanation string `json:"lock_explanation"`
UserName string `json:"user_name"`
TopicChildren []int `json:"topic_children"`
GroupTopicChildren []struct {
ID int `json:"id"`
GroupID int `json:"group_id"`
} `json:"group_topic_children"`
RootTopicID interface{} `json:"root_topic_id"`
PodcastURL string `json:"podcast_url"`
DiscussionType string `json:"discussion_type"`
GroupCategoryID interface{} `json:"group_category_id"`
Attachments interface{} `json:"attachments"`
Permissions struct {
Attach bool `json:"attach"`
} `json:"permissions"`
AllowRating bool `json:"allow_rating"`
OnlyGradersCanRate bool `json:"only_graders_can_rate"`
SortByRating bool `json:"sort_by_rating"`
}
DiscussionTopic is a discussion topic
func Announcements ¶
func Announcements(contextCodes []string, opts ...Option) ([]DiscussionTopic, error)
Announcements will get the announcements
type Enrollment ¶
type Enrollment struct {
ID int `json:"id"`
CourseID int `json:"course_id"`
SisCourseID string `json:"sis_course_id"`
CourseIntegrationID string `json:"course_integration_id"`
CourseSectionID int `json:"course_section_id"`
SectionIntegrationID string `json:"section_integration_id"`
SisAccountID string `json:"sis_account_id"`
SisSectionID string `json:"sis_section_id"`
SisUserID string `json:"sis_user_id"`
EnrollmentState string `json:"enrollment_state"`
LimitPrivilegesToCourseSection bool `json:"limit_privileges_to_course_section"`
SisImportID int `json:"sis_import_id"`
RootAccountID int `json:"root_account_id"`
Type string `json:"type"`
UserID int `json:"user_id"`
AssociatedUserID interface{} `json:"associated_user_id"`
Role string `json:"role"`
RoleID int `json:"role_id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
StartAt time.Time `json:"start_at"`
EndAt time.Time `json:"end_at"`
LastActivityAt time.Time `json:"last_activity_at"`
LastAttendedAt time.Time `json:"last_attended_at"`
TotalActivityTime int `json:"total_activity_time"`
HTMLURL string `json:"html_url"`
Grades struct {
HTMLURL string `json:"html_url"`
CurrentScore string `json:"current_score"`
CurrentGrade string `json:"current_grade"`
FinalScore float64 `json:"final_score"`
FinalGrade string `json:"final_grade"`
UnpostedCurrentGrade string `json:"unposted_current_grade"`
UnpostedFinalGrade string `json:"unposted_final_grade"`
UnpostedCurrentScore string `json:"unposted_current_score"`
UnpostedFinalScore string `json:"unposted_final_score"`
} `json:"grades"`
User struct {
ID int `json:"id"`
Name string `json:"name"`
SortableName string `json:"sortable_name"`
ShortName string `json:"short_name"`
} `json:"user"`
OverrideGrade string `json:"override_grade"`
OverrideScore float64 `json:"override_score"`
UnpostedCurrentGrade string `json:"unposted_current_grade"`
UnpostedFinalGrade string `json:"unposted_final_grade"`
UnpostedCurrentScore string `json:"unposted_current_score"`
UnpostedFinalScore string `json:"unposted_final_score"`
HasGradingPeriods bool `json:"has_grading_periods"`
TotalsForAllGradingPeriodsOption bool `json:"totals_for_all_grading_periods_option"`
CurrentGradingPeriodTitle string `json:"current_grading_period_title"`
CurrentGradingPeriodID int `json:"current_grading_period_id"`
CurrentPeriodOverrideGrade string `json:"current_period_override_grade"`
CurrentPeriodOverrideScore float64 `json:"current_period_override_score"`
CurrentPeriodUnpostedCurrentScore float64 `json:"current_period_unposted_current_score"`
CurrentPeriodUnpostedFinalScore float64 `json:"current_period_unposted_final_score"`
CurrentPeriodUnpostedCurrentGrade string `json:"current_period_unposted_current_grade"`
CurrentPeriodUnpostedFinalGrade string `json:"current_period_unposted_final_grade"`
}
Enrollment is an enrollment object
type Error ¶
type Error struct {
Errors struct {
EndDate string `json:"end_date"`
} `json:"errors"`
Message string `json:"message"`
}
Error is an error response.
type File ¶
type File struct {
ID int `json:"id"`
FolderID int `json:"folder_id"`
URL string `json:"url"`
UUID string `json:"uuid"`
Filename string `json:"filename"`
DisplayName string `json:"display_name"`
ContentType string `json:"content-type"`
Size int `json:"size"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
ModifiedAt time.Time `json:"modified_at"`
Locked bool `json:"locked"`
UnlockAt time.Time `json:"unlock_at"`
Hidden bool `json:"hidden"`
LockAt time.Time `json:"lock_at"`
HiddenForUser bool `json:"hidden_for_user"`
ThumbnailURL string `json:"thumbnail_url"`
MimeClass string `json:"mime_class"`
MediaEntryID string `json:"media_entry_id"`
LockedForUser bool `json:"locked_for_user"`
LockInfo interface{} `json:"lock_info"`
LockExplanation string `json:"lock_explanation"`
PreviewURL string `json:"preview_url"`
// contains filtered or unexported fields
}
File is a file
func (*File) ParentFolder ¶
ParentFolder will get the folder that the file is a part of.
type Folder ¶
type Folder struct {
ID int `json:"id"`
Name string `json:"name"`
FullName string `json:"full_name"`
FilesURL string `json:"files_url"`
FoldersURL string `json:"folders_url"`
ContextType string `json:"context_type"`
ContextID int `json:"context_id"`
Position int `json:"position"`
FilesCount int `json:"files_count"`
FoldersCount int `json:"folders_count"`
UpdatedAt time.Time `json:"updated_at"`
LockAt time.Time `json:"lock_at"`
Locked bool `json:"locked"`
ParentFolderID int `json:"parent_folder_id"`
CreatedAt time.Time `json:"created_at"`
UnlockAt interface{} `json:"unlock_at"`
Hidden bool `json:"hidden"`
HiddenForUser bool `json:"hidden_for_user"`
LockedForUser bool `json:"locked_for_user"`
ForSubmissions bool `json:"for_submissions"`
// contains filtered or unexported fields
}
Folder is a folder
func (*Folder) ParentFolder ¶
ParentFolder will get the folder's parent folder.
type Option ¶
Option is a key value pair used for api parameters. see Opt
func ArrayOpt ¶
ArrayOpt creates an option that will be sent as an array of options (ex. include[], content_type[], etc.)
func ContentType ¶
ContentType retruns a option param for getting a content type.
func IncludeOpt ¶
IncludeOpt is the option for any "include[]" api parameters.
type Quiz ¶
type Quiz struct {
ID int `json:"id"`
Title string `json:"title"`
DueAt string `json:"due_at"`
LockAt time.Time `json:"lock_at"`
UnlockAt string `json:"unlock_at"`
HTMLURL string `json:"html_url"`
MobileURL string `json:"mobile_url"`
PreviewURL string `json:"preview_url"`
Description string `json:"description"`
QuizType string `json:"quiz_type"`
AssignmentGroupID int `json:"assignment_group_id"`
TimeLimit int `json:"time_limit"`
ShuffleAnswers bool `json:"shuffle_answers"`
HideResults string `json:"hide_results"`
ShowCorrectAnswers bool `json:"show_correct_answers"`
ShowCorrectAnswersLastAttempt bool `json:"show_correct_answers_last_attempt"`
ShowCorrectAnswersAt time.Time `json:"show_correct_answers_at"`
HideCorrectAnswersAt time.Time `json:"hide_correct_answers_at"`
OneTimeResults bool `json:"one_time_results"`
ScoringPolicy string `json:"scoring_policy"`
AllowedAttempts int `json:"allowed_attempts"`
OneQuestionAtATime bool `json:"one_question_at_a_time"`
QuestionCount int `json:"question_count"`
PointsPossible int `json:"points_possible"`
CantGoBack bool `json:"cant_go_back"`
AccessCode string `json:"access_code"`
IPFilter string `json:"ip_filter"`
Published bool `json:"published"`
Unpublishable bool `json:"unpublishable"`
LockedForUser bool `json:"locked_for_user"`
LockInfo interface{} `json:"lock_info"`
LockExplanation string `json:"lock_explanation"`
SpeedgraderURL string `json:"speedgrader_url"`
QuizExtensionsURL string `json:"quiz_extensions_url"`
Permissions QuizPermissions `json:"permissions"`
AllDates []string `json:"all_dates"`
VersionNumber int `json:"version_number"`
QuestionTypes []string `json:"question_types"`
AnonymousSubmissions bool `json:"anonymous_submissions"`
}
Quiz is a quiz json response.
type QuizPermissions ¶
type QuizPermissions struct {
Read bool `json:"read"`
Submit bool `json:"submit"`
Create bool `json:"create"`
Manage bool `json:"manage"`
ReadStatistics bool `json:"read_statistics"`
ReviewGrades bool `json:"review_grades"`
Update bool `json:"update"`
}
QuizPermissions is the permissions for a quiz.
type Submission ¶
type Submission struct {
AssignmentID int `json:"assignment_id"`
Assignment interface{} `json:"assignment"`
Course interface{} `json:"course"`
Attempt int `json:"attempt"`
Body string `json:"body"`
Grade string `json:"grade"`
GradeMatchesCurrentSubmission bool `json:"grade_matches_current_submission"`
HTMLURL string `json:"html_url"`
PreviewURL string `json:"preview_url"`
Score float64 `json:"score"`
SubmissionComments interface{} `json:"submission_comments"`
SubmissionType string `json:"submission_type"`
SubmittedAt time.Time `json:"submitted_at"`
URL interface{} `json:"url"`
UserID int `json:"user_id"`
GraderID int `json:"grader_id"`
GradedAt time.Time `json:"graded_at"`
User interface{} `json:"user"`
Late bool `json:"late"`
AssignmentVisible bool `json:"assignment_visible"`
Excused bool `json:"excused"`
Missing bool `json:"missing"`
LatePolicyStatus string `json:"late_policy_status"`
PointsDeducted float64 `json:"points_deducted"`
SecondsLate int `json:"seconds_late"`
WorkflowState string `json:"workflow_state"`
ExtraAttempts int `json:"extra_attempts"`
AnonymousID string `json:"anonymous_id"`
PostedAt time.Time `json:"posted_at"`
}
Submission is a submission type.
type Term ¶
type Term struct {
ID int
Name string
StartAt time.Time `json:"start_at"`
EndAt time.Time `json:"end_at"`
}
Term is a school term. One school year.
type User ¶
type User struct {
ID int `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
Bio string `json:"bio"`
SortableName string `json:"sortable_name"`
ShortName string `json:"short_name"`
SisUserID string `json:"sis_user_id"`
SisImportID int `json:"sis_import_id"`
IntegrationID string `json:"integration_id"`
CreatedAt time.Time `json:"created_at"`
LoginID string `json:"login_id"`
AvatarURL string `json:"avatar_url"`
Enrollments Enrollment `json:"enrollments"`
Locale string `json:"locale"`
EffectiveLocale string `json:"effective_locale"`
LastLogin time.Time `json:"last_login"`
TimeZone string `json:"time_zone"`
CanUpdateAvatar bool `json:"can_update_avatar"`
Permissions struct {
CanUpdateName bool `json:"can_update_name"`
CanUpdateAvatar bool `json:"can_update_avatar"`
LimitParentAppWebAccess bool `json:"limit_parent_app_web_access"`
} `json:"permissions"`
// contains filtered or unexported fields
}
User is a canvas user
func CurrentUser ¶
CurrentUser get the currently logged in user.
func (*User) CalendarEvents ¶
func (u *User) CalendarEvents(opts ...Option) (cal []CalendarEvent, err error)
CalendarEvents gets the user's calendar events.
func (*User) CreateBookmark ¶
CreateBookmark will create a bookmark
func (*User) DeleteBookmark ¶
DeleteBookmark will delete a user's bookmark.
func (*User) GradedSubmissions ¶
func (u *User) GradedSubmissions() (subs []*Submission, err error)
GradedSubmissions gets the user's graded submissions.
func (*User) Profile ¶
func (u *User) Profile() (p *UserProfile, err error)
Profile will make a call to get the user's profile data.
type UserColor ¶
type UserColor struct {
HexCode string `json:"hexcode"`
}
UserColor is just a hex color.
type UserProfile ¶
type UserProfile struct {
ID int `json:"id"`
LoginID string `json:"login_id"`
Name string `json:"name"`
PrimaryEmail string `json:"primary_email"`
ShortName string `json:"short_name"`
SortableName string `json:"sortable_name"`
TimeZone string `json:"time_zone"`
Bio string `json:"bio"`
Title string `json:"title"`
Calendar map[string]string `json:"calendar"`
LTIUserID string `json:"lti_user_id"`
AvatarURL string `json:"avatar_url"`
EffectiveLocal string `json:"effective_local"`
IntegrationID string `json:"integration_id"`
Local string `json:"local"`
}
UserProfile is a user's profile data.