Documentation ¶
Index ¶
- Variables
- type Client
- func (c *Client) Demo() ([]*Problem, error)
- func (c *Client) Do(req *http.Request, v interface{}) (*http.Response, error)
- func (c *Client) Download(submissionID string) (*Submission, error)
- func (c *Client) Fetch(args []string) ([]*Problem, error)
- func (c *Client) List(language string) ([]string, error)
- func (c *Client) NewRequest(method, url string, body io.Reader) (*http.Request, error)
- func (c *Client) Restore() ([]*Problem, error)
- func (c *Client) Skip(language, slug string) error
- func (c *Client) Submission(language, excercise string) (*Submission, error)
- func (c *Client) Submissions() (map[string][]SubmissionInfo, error)
- func (c *Client) Submit(iter *Iteration) (*Submission, error)
- func (c *Client) Tracks() ([]*Track, error)
- func (c *Client) Unsubmit() error
- type Iteration
- type PayloadError
- type PayloadProblems
- type PayloadSubmission
- type Problem
- type Submission
- type SubmissionInfo
- type Track
Constants ¶
This section is empty.
Variables ¶
var ( // ErrUnknownLanguage represents an error returned when the language requested does not exist ErrUnknownLanguage = errors.New("the language is unknown") )
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 ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { APIHost string XAPIHost string APIKey string // contains filtered or unexported fields }
Client contains the necessary information to contact the Exercism APIs
func (*Client) Do ¶
Do performs an http.Request and optionally parses the response body into the given interface
func (*Client) Download ¶
func (c *Client) Download(submissionID string) (*Submission, error)
Download fetches a solution by submission key and writes it to disk.
func (*Client) Fetch ¶
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 (*Client) NewRequest ¶
NewRequest returns an http.Request with information for the Exercism API
func (*Client) Submission ¶
func (c *Client) Submission(language, excercise string) (*Submission, error)
Submission get the latest submitted exercise for the given language and exercise
func (*Client) Submissions ¶
func (c *Client) Submissions() (map[string][]SubmissionInfo, error)
Submissions gets a list of submitted exercises and their current acceptance state.
func (*Client) Submit ¶
func (c *Client) Submit(iter *Iteration) (*Submission, error)
Submit posts code to the API
type Iteration ¶
type Iteration struct { Key string `json:"key"` Code string `json:"code"` Dir string `json:"dir"` Language string `json:"language"` Problem string `json:"problem"` Solution map[string]string `json:"solution"` }
Iteration represents a version of a particular exercise. This gets submitted to the API.
func NewIteration ¶
NewIteration prepares an iteration of a problem in a track for submission to the API. It takes a dir and a list of files which it will read from disk. All paths are assumed to be absolute paths with symlinks resolved.
func (*Iteration) RelativePath ¶ added in v1.7.5
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"` Submitted bool }
Problem represents a specific problem in a given language track.
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.
type SubmissionInfo ¶
SubmissionInfo contains state information about a submission.
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.