hackerrank

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Accepted         Status = "Accepted"
	Success                 = "Success"
	Processing              = "Processing"
	CompilationError        = "Compilation error"
	RuntimeError            = "Runtime Error"
	TimeoutError            = "Terminated due to timeout"
)

Variables

This section is empty.

Functions

func LocalizeLanguage

func LocalizeLanguage(lang provider.Lang) (string, error)

Types

type ChallengeData

type ChallengeData struct {
	Solved      bool     `json:"solved"`
	Attempted   bool     `json:"attempted"`
	ContestSlug string   `json:"contest_slug"`
	Slug        string   `json:"slug"`
	Name        string   `json:"name"`
	Preview     string   `json:"preview"`
	Category    string   `json:"category"`
	BodyHtml    string   `json:"body_html"`
	Languages   []string `json:"languages"`
	Track       Track    `json:"track"`
	MaxScore    int64    `json:"max_score"`

	CTemplate     string `json:"c_template"`
	CTemplateHead string `json:"c_template_head"`
	CTemplateTail string `json:"c_template_tail"`

	CppTemplate     string `json:"cpp_template"`
	CppTemplateHead string `json:"cpp_template_head"`
	CppTemplateTail string `json:"cpp_template_tail"`

	JavaTemplate     string `json:"java_template"`
	JavaTemplateHead string `json:"java_template_head"`
	JavaTemplateTail string `json:"java_template_tail"`

	CsharpTemplate     string `json:"csharp_template"`
	CsharpTemplateHead string `json:"csharp_template_head"`
	CsharpTemplateTail string `json:"csharp_template_tail"`

	PhpTemplate     string `json:"php_template"`
	PhpTemplateHead string `json:"php_template_head"`
	PhpTemplateTail string `json:"php_template_tail"`

	RubyTemplate     string `json:"ruby_template"`
	RubyTemplateHead string `json:"ruby_template_head"`
	RubyTemplateTail string `json:"ruby_template_tail"`

	PythonTemplate     string `json:"python_template"`
	PythonTemplateHead string `json:"python_template_head"`
	PythonTemplateTail string `json:"python_template_tail"`

	PerlTemplate     string `json:"perl_template"`
	PerlTemplateHead string `json:"perl_template_head"`
	PerlTemplateTail string `json:"perl_template_tail"`

	HaskellTemplate     string `json:"haskell_template"`
	HaskellTemplateHead string `json:"haskell_template_head"`
	HaskellTemplateTail string `json:"haskell_template_tail"`

	ClojureTemplate     string `json:"clojure_template"`
	ClojureTemplateHead string `json:"clojure_template_head"`
	ClojureTemplateTail string `json:"clojure_template_tail"`

	ScalaTemplate     string `json:"scala_template"`
	ScalaTemplateHead string `json:"scala_template_head"`
	ScalaTemplateTail string `json:"scala_template_tail"`

	LuaTemplate     string `json:"lua_template"`
	LuaTemplateHead string `json:"lua_template_head"`
	LuaTemplateTail string `json:"lua_template_tail"`

	ErlangTemplate     string `json:"erlang_template"`
	ErlangTemplateHead string `json:"erlang_template_head"`
	ErlangTemplateTail string `json:"erlang_template_tail"`

	JavascriptTemplate     string `json:"javascript_template"`
	JavascriptTemplateHead string `json:"javascript_template_head"`
	JavascriptTemplateTail string `json:"javascript_template_tail"`

	TypescriptTemplate     string `json:"typescript_template"`
	TypescriptTemplateHead string `json:"typescript_template_head"`
	TypescriptTemplateTail string `json:"typescript_template_tail"`

	GoTemplate     string `json:"go_template"`
	GoTemplateHead string `json:"go_template_head"`
	GoTemplateTail string `json:"go_template_tail"`

	Python3Template     string `json:"python3_template"`
	Python3TemplateHead string `json:"python3_template_head"`
	Python3TemplateTail string `json:"python3_template_tail"`

	ObjectivecTemplate     string `json:"objectivec_template"`
	ObjectivecTemplateHead string `json:"objectivec_template_head"`
	ObjectivecTemplateTail string `json:"objectivec_template_tail"`

	Java8Template     string `json:"java8_template"`
	Java8TemplateHead string `json:"java8_template_head"`
	Java8TemplateTail string `json:"java8_template_tail"`

	SwiftTemplate     string `json:"swift_template"`
	SwiftTemplateHead string `json:"swift_template_head"`
	SwiftTemplateTail string `json:"swift_template_tail"`

	Cpp14Template     string `json:"cpp14_template"`
	Cpp14TemplateHead string `json:"cpp14_template_head"`
	Cpp14TemplateTail string `json:"cpp14_template_tail"`

	PypyTemplate     string `json:"pypy_template"`
	PypyTemplateHead string `json:"pypy_template_head"`
	PypyTemplateTail string `json:"pypy_template_tail"`

	Pypy3Template     string `json:"pypy3_template"`
	Pypy3TemplateHead string `json:"pypy3_template_head"`
	Pypy3TemplateTail string `json:"pypy3_template_tail"`

	KotlinTemplate     string `json:"kotlin_template"`
	KotlinTemplateHead string `json:"kotlin_template_head"`
	KotlinTemplateTail string `json:"kotlin_template_tail"`

	Java15Template     string `json:"java15_template"`
	Java15TemplateHead string `json:"java15_template_head"`
	Java15TemplateTail string `json:"java15_template_tail"`
}

func (*ChallengeData) Files

func (data *ChallengeData) Files() (map[string]string, error)

func (*ChallengeData) Identify

func (data *ChallengeData) Identify() provider.Filters

func (*ChallengeData) Prompt

func (data *ChallengeData) Prompt() string

func (*ChallengeData) Snippet

func (data *ChallengeData) Snippet(lang provider.Lang) (string, error)

type Client

type Client struct {
	DoPurchase bool // optional
	// contains filtered or unexported fields
}

func NewClient

func NewClient(base *url.URL) *Client

func (*Client) Configure

func (client *Client) Configure(config provider.BackendConfig) error

func (*Client) Do

func (client *Client) Do(method string, path string, req interface{}, output interface{}) error

func (*Client) DoMany

func (client *Client) DoMany(method string, path string, req interface{}, output interface{}) error

func (*Client) DoSubmit

func (client *Client) DoSubmit(contest string, slug string, lang string, code string) (*SubmissionState, error)

func (*Client) FindNextChallenge

func (client *Client) FindNextChallenge(filters provider.Filters) (provider.Filters, error)

func (*Client) GetChallenge

func (client *Client) GetChallenge(filters provider.Filters) (provider.Challenge, error)

func (*Client) GetChallengeData

func (client *Client) GetChallengeData(contest string, challenge string) (*ChallengeData, error)

func (*Client) GetLogIn

func (client *Client) GetLogIn() (string, string, error)

func (*Client) GetTestcaseData

func (client *Client) GetTestcaseData(contest string, challengeId int64, submissionId int64, testcaseId int64) (*TestcaseData, error)

func (*Client) GetUnlockedTestcases

func (client *Client) GetUnlockedTestcases(contest string, challengeId int64) ([]int64, error)

func (*Client) HasUnlockedTestcase

func (client *Client) HasUnlockedTestcase(contest string, challengeId int64, target int64) (bool, error)

func (*Client) IsSignedIn

func (client *Client) IsSignedIn() (bool, error)

func (*Client) ListChallenges

func (client *Client) ListChallenges(contest string, track string, offset uint64, limit uint64, filters map[string][]string) ([]ChallengeData, error)

func (*Client) PurchaseTestcaseData

func (client *Client) PurchaseTestcaseData(contest string, challengeId int64, submissionId int64, testcaseId int64) (int64, error)

func (*Client) Submit

func (client *Client) Submit(filters provider.Filters, lang provider.Lang, code string) (provider.SubmissionReport, error)

type Status

type Status string

type SubmissionState

type SubmissionState struct {
	Id                      int64     `json:"id"`
	ContestId               int64     `json:"contest_id"`
	ChallengeId             int64     `json:"challenge_id"`
	Language                string    `json:"language"`
	Status                  Status    `json:"status"`
	ChallengeSlug           string    `json:"challenge_slug"`
	ContestSlug             string    `json:"contest_slug"`
	CompileStatus           int64     `json:"compile_status"`
	CompileMessage          string    `json:"compile_message"`
	TestcaseStatus          []int64   `json:"testcase_status"`
	TestcaseMessage         []string  `json:"testcase_message"`
	CodecheckerTime         []float64 `json:"codecheck_time"`
	CodecheckerSignal       []int64   `json:"codechecker_signal"`
	IndividualTestcaseScore []float64 `json:"individual_test_case_score"`
	DisplayScore            string    `json:"display_score"`
	// contains filtered or unexported fields
}

func (*SubmissionState) ErrorReport

func (state *SubmissionState) ErrorReport() *provider.ErrorReport

func (*SubmissionState) HasSucceeded

func (state *SubmissionState) HasSucceeded() bool

func (*SubmissionState) Identify

func (state *SubmissionState) Identify() string

func (*SubmissionState) IsDone

func (state *SubmissionState) IsDone() bool

func (*SubmissionState) Statistics

func (state *SubmissionState) Statistics() provider.SubmissionStatistics

type SubmitRequest

type SubmitRequest struct {
	Code         string `json:"code"`
	ContestSlug  string `json:"contest_slug"`
	Language     string `json:"language"`
	PlaylistSlug string `json:"playlist_slug"` // optional
}

type TestcaseData

type TestcaseData struct {
	Stdin          string `json:"stdin"`
	ExpectedOutput string `json:"expected_output"`
}

type Track

type Track struct {
	Id        int64  `json:"id"`
	Name      string `json:"name"`
	Slug      string `json:"slug"`
	TrackId   int64  `json:"track_id"`
	TrackName string `json:"track_name"`
	TrackSlug string `json:"track_slug"`
}

Jump to

Keyboard shortcuts

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