goscope

package module
v0.0.0-...-de5569a Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2024 License: MPL-2.0 Imports: 19 Imported by: 0

README

goscope

goscope is a Go library for accessing Gradescope. This library is mainly designed for use with a student account for accessing programming assignments, specifically for use in the accompanying TUI program goscope.

License

This repository (including the library and TUI program) is licensed under the Mozilla Public License, version 2.0. For more information, please see LICENSE.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Assignment

type Assignment struct {
	Name   string
	ID     uint
	Status string // submitted state or score

	ReleaseDate time.Time
	DueDate     time.Time

	HasSubmissionAvailable bool

	// ID of submission active for an assignment
	ActiveSubmissionID uint

	// HasCompleteData indicates the presence of valid data for IsProgrammingAssignment, HasLeaderboard, and AllowsUploads
	HasCompleteData bool

	IsProgrammingAssignment bool
	HasLeaderboard          bool
	AllowsUploads           bool

	*Course
}

Course is the representation of an assignment for a course

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a client necessary to interact with Gradescope, which can be initialized with goscope.New()

func New

func New() *Client

New returns a pointer to a new Client for interacting with Gradescope

func (*Client) GetCourseAssignments

func (c *Client) GetCourseAssignments(course *Course) ([]Assignment, error)

GetCourseAssignments returns the assignments for a course

func (*Client) GetCourses

func (c *Client) GetCourses() ([]Course, error)

GetCourses returns the courses in a student's dashboard (only student courses)

func (*Client) GetSubmissions

func (c *Client) GetSubmissions(assignment *Assignment) ([]Submission, error)

GetSubmissions returns all the past submissions associated with an assignment

func (*Client) IsLoggedIn

func (c *Client) IsLoggedIn() bool

IsLoggedIn returns whether a client is logged in

func (*Client) LoginWithGradescope

func (c *Client) LoginWithGradescope(email, password string) error

LoginWithGradescope attempts to login to an account with the default Gradescope account (requires an email and password)

func (*Client) LoginWithSSO

func (c *Client) LoginWithSSO(slug, username, password string) error

LoginWithSSO attempts to login utilizing an institution's single sign-on (Gradescope's "school credentials" login option), with the slug used by Gradescope and the account's associated username and password; this method only supports SSO systems utilizing Shibboleth

func (*Client) StoreAssignmentExtraData

func (c *Client) StoreAssignmentExtraData(assignment *Assignment) error

StoreSubmissionExtraData adds data to the IsProgrammingAssignment, HasLeaderboard, and AllowsUploads fields to an assignment

func (*Client) StoreSubmissionExtraData

func (c *Client) StoreSubmissionExtraData(submission *Submission) error

StoreSubmissionExtraData adds data to the Files, AutograderResults, and Questions fields to a submission

func (*Client) SubmitProgrammingAssignmentCustom

func (c *Client) SubmitProgrammingAssignmentCustom(assignment *Assignment, fileData map[string]string) (string, error)

SubmitProgrammingAssignmentCustom submits data supplied in a map[string]string to an assignment

func (*Client) SubmitProgrammingAssignmentFiles

func (c *Client) SubmitProgrammingAssignmentFiles(
	assignment *Assignment,
	filenames []string,
	pathToTrim string,
) (string, error)

SubmitProgrammingAssignmentFiles submits data to an assignment with the supplied filenames (prefix trimmed with pathToTrim)

type Course

type Course struct {
	Name      string
	ShortName string
	ID        uint
}

Course is the representation of a course

type Submission

type Submission struct {
	ID           uint
	CreationDate time.Time
	IsActive     bool

	// HasCompleteData indicates the presence of valid data for Files, AutograderResults, and Questions
	HasCompleteData bool

	Files             []submissionFile  // files submitted
	AutograderResults autograderResults // results of autograder test cases
	Questions         []question        // questions and associated scores

	*Assignment
}

Submission is the representation of a submission for an assignment

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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