cses

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

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

Go to latest
Published: Feb 16, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

README

cses-cli

cses-cli is a command line interface for cses.fi website.

Installation

Make sure you have the Go toolchain version 1.13 or above installed. Install or update the app by running

go get -u go.lassilaiho.com/cses-cli/cmd/cses-cli

The API used by the command line app is provided in the package go.lassilaiho.com/cses-cli.

License

Apache-2.0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

API provides an API for the CSES website.

func FromSessionToken

func FromSessionToken(token string) (*API, error)

FromSessionToken returns an API using a session token.

func Login

func Login(username, password string) (*API, error)

Login logs in a user.

func (*API) Close

func (api *API) Close() error

Close logs out of the API. The API can't be used after calling Close.

func (*API) CreateSubmission

func (api *API) CreateSubmission(course string, taskID int, file io.Reader, lang, option string) (int, error)

CreateSubmission creates a new submission from file.

func (*API) GetSubmissionDetails

func (api *API) GetSubmissionDetails(course string, submissionID int) (*SubmissionDetails, error)

GetSubmissionDetails returns detailed information about a submission.

func (*API) GetSubmissionProgress

func (api *API) GetSubmissionProgress(submissionID int) (int, error)

GetSubmissionProgress returns a percentage as an integer between 0 and 100 inclusive which denotes the progress of the submission.

func (*API) GetSubmissions

func (api *API) GetSubmissions(course string, taskID int) ([]*Submission, error)

GetSubmissions returns all submissions.

func (*API) ResolveTaskIdentifier

func (api *API) ResolveTaskIdentifier(course, ident string) (int, error)

ResolveTaskIdentifier returns the id of the task matching ident.

func (*API) SessionToken

func (api *API) SessionToken() string

SessionToken returns the session token used by the API.

type Submission

type Submission struct {
	ID       int
	Time     time.Time
	Language string
	CodeTime time.Duration
	CodeSize int
	Result   SubmissionState
}

Submission is a solution attempt.

type SubmissionDetails

type SubmissionDetails struct {
	ID                int
	TaskID            int
	Sender            string
	SubmissionTime    time.Time
	Language          string
	Result            SubmissionState
	ResultDescription string
	CompilerReport    string
	Code              string
	TestResults       []*TestResult
}

SubmissionDetails contains detailed information about a submission.

type SubmissionState

type SubmissionState byte

SubmissionState is the state the submission is in.

const (
	SubmissionPending SubmissionState = iota
	SubmissionFailed
	SubmissionCompleted
)

Submission state constants.

func (SubmissionState) String

func (s SubmissionState) String() string

type TestResult

type TestResult struct {
	ID            int
	Verdict       string
	ExecTime      time.Duration
	Input         string
	CorrectOutput string
	UserOutput    string
}

TestResult represents the result of a test.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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