api

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2014 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// UserAgent lets the API know where the call is being made from.
	// It's set from main() so that we have access to the version.
	UserAgent string
)

Functions

func Unsubmit

func Unsubmit(url string) error

Unsubmit deletes a submission.

Types

type Iteration

type Iteration struct {
	Key      string `json:"key"`
	Code     string `json:"code"`
	Path     string `json:"path"`
	Dir      string `json:"dir"`
	File     string `json:"-"`
	Language string `json:"-"`
	Problem  string `json:"-"`
}

Iteration represents a version of a particular exercise. This gets submitted to the API.

func (*Iteration) Identify added in v1.7.5

func (iter *Iteration) Identify() error

Identify attempts to determine the track and problem of an iteration.

func (*Iteration) RelativePath added in v1.7.5

func (iter *Iteration) RelativePath() string

RelativePath returns the path relative to the exercism dir.

type PayloadError

type PayloadError struct {
	Error string `json:"error"`
}

PayloadError represents an error message from the API.

type PayloadProblems

type PayloadProblems struct {
	Problems []*Problem
	PayloadError
}

PayloadProblems represents a response containing problems.

type PayloadSubmission

type PayloadSubmission struct {
	*Submission
	PayloadError
}

PayloadSubmission represents metadata about a successful submission.

type Problem

type Problem struct {
	ID       string            `json:"id"`
	TrackID  string            `json:"track_id"`
	Language string            `json:"language"`
	Slug     string            `json:"slug"`
	Name     string            `json:"name"`
	Files    map[string]string `json:"files"`
}

Problem represents a specific problem in a given language track.

func Demo

func Demo(c *config.Config) ([]*Problem, error)

Demo fetches the first problem in each language track.

func Fetch

func Fetch(url string) ([]*Problem, error)

Fetch retrieves problems from the API. In most cases these problems consist of a test suite and a README from the x-api, but it is also used when restoring earlier iterations.

func (*Problem) String

func (p *Problem) String() string

type Submission

type Submission struct {
	URL           string            `json:"url"`
	TrackID       string            `json:"track_id"`
	Language      string            `json:"language"`
	Slug          string            `json:"slug"`
	Name          string            `json:"name"`
	Username      string            `json:"username"`
	ProblemFiles  map[string]string `json:"problem_files"`
	SolutionFiles map[string]string `json:"solution_files"`
}

Submission is an iteration that has been submitted to the API.

func Download added in v1.9.0

func Download(url string) (*Submission, error)

func Submit

func Submit(url string, iter *Iteration) (*Submission, error)

Submit posts code to the API

type Track added in v1.8.0

type Track struct {
	ID       string   `json:"id"`
	Language string   `json:"language"`
	Active   bool     `json:"active"`
	Problems []string `json:"problems"`
}

Track is a collection of problems in a given language.

func Tracks added in v1.8.0

func Tracks(url string) ([]*Track, error)

Tracks gets the current list of active and inactive language tracks.

func (*Track) Len added in v1.8.0

func (t *Track) Len() int

Len lists the number of problems a track has.

func (*Track) String added in v1.8.0

func (t *Track) String() string

Jump to

Keyboard shortcuts

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