api

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2024 License: Apache-2.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Author added in v0.0.4

type Author struct {
	DisplayName        string `json:"displayName"`
	ExternalProfileURL string `json:"externalProfileUrl"`
}

type Challenge added in v0.0.4

type Challenge struct {
	CreatedAt string `json:"createdAt" yaml:"createdAt"`
	UpdatedAt string `json:"updatedAt" yaml:"updatedAt"`

	Name string `json:"name" yaml:"name"`

	PageURL string `json:"pageUrl" yaml:"pageUrl"`

	AttemptCount    int `json:"attemptCount" yaml:"attemptCount"`
	CompletionCount int `json:"completionCount" yaml:"completionCount"`
}

func (*Challenge) GetKind added in v0.0.4

func (ch *Challenge) GetKind() content.ContentKind

func (*Challenge) GetName added in v0.0.4

func (ch *Challenge) GetName() string

func (*Challenge) GetPageURL added in v0.0.4

func (ch *Challenge) GetPageURL() string

type Client

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

func NewClient

func NewClient(opts ClientOptions) *Client

func (*Client) CreateAuthor added in v0.0.4

func (c *Client) CreateAuthor(ctx context.Context, req CreateAuthorRequest) (*Author, error)

func (*Client) CreateChallenge added in v0.0.4

func (c *Client) CreateChallenge(ctx context.Context, req CreateChallengeRequest) (*Challenge, error)

func (*Client) CreateCourse added in v0.0.4

func (c *Client) CreateCourse(ctx context.Context, req CreateCourseRequest) (*Course, error)

func (*Client) CreatePlay

func (c *Client) CreatePlay(ctx context.Context, req CreatePlayRequest) (*Play, error)

func (*Client) CreateSession

func (c *Client) CreateSession(ctx context.Context) (*Session, error)

func (*Client) CreateTutorial added in v0.0.4

func (c *Client) CreateTutorial(ctx context.Context, req CreateTutorialRequest) (*Tutorial, error)

func (*Client) Delete

func (c *Client) Delete(
	ctx context.Context,
	path string,
	query url.Values,
	headers http.Header,
) (*http.Response, error)

func (*Client) DeleteChallenge added in v0.0.4

func (c *Client) DeleteChallenge(ctx context.Context, name string) error

func (*Client) DeleteContentFile added in v0.0.4

func (c *Client) DeleteContentFile(
	ctx context.Context,
	kind content.ContentKind,
	name string,
	file string,
) error

func (*Client) DeleteCourse added in v0.0.4

func (c *Client) DeleteCourse(ctx context.Context, name string) error

func (*Client) DeletePlay

func (c *Client) DeletePlay(ctx context.Context, id string) error

func (*Client) DeleteSession

func (c *Client) DeleteSession(ctx context.Context, id string) error

func (*Client) DeleteTutorial added in v0.0.4

func (c *Client) DeleteTutorial(ctx context.Context, name string) error

func (*Client) Download added in v0.0.4

func (c *Client) Download(
	ctx context.Context,
	path string,
	query url.Values,
	headers http.Header,
	dest io.Writer,
) error

func (*Client) DownloadContentFile added in v0.0.4

func (c *Client) DownloadContentFile(
	ctx context.Context,
	kind content.ContentKind,
	name string,
	file string,
	dest string,
) error

func (*Client) DownloadTo added in v0.0.4

func (c *Client) DownloadTo(
	ctx context.Context,
	path string,
	query url.Values,
	headers http.Header,
	file string,
) error

func (*Client) Get

func (c *Client) Get(
	ctx context.Context,
	path string,
	query url.Values,
	headers http.Header,
) (*http.Response, error)

func (*Client) GetChallenge added in v0.0.4

func (c *Client) GetChallenge(ctx context.Context, name string) (*Challenge, error)

func (*Client) GetCourse added in v0.0.4

func (c *Client) GetCourse(ctx context.Context, name string) (*Course, error)

func (*Client) GetInto

func (c *Client) GetInto(
	ctx context.Context,
	path string,
	query url.Values,
	headers http.Header,
	into any,
) error

func (*Client) GetMe added in v0.0.4

func (c *Client) GetMe(ctx context.Context) (*Me, error)

func (*Client) GetPlay

func (c *Client) GetPlay(ctx context.Context, id string) (*Play, error)

func (*Client) GetPlayground

func (c *Client) GetPlayground(ctx context.Context, name string) (*Playground, error)

func (*Client) GetSession

func (c *Client) GetSession(ctx context.Context, id string) (*Session, error)

func (*Client) GetTutorial added in v0.0.4

func (c *Client) GetTutorial(ctx context.Context, name string) (*Tutorial, error)

func (*Client) ListAuthoredChallenges added in v0.0.4

func (c *Client) ListAuthoredChallenges(ctx context.Context) ([]Challenge, error)

func (*Client) ListAuthoredCourses added in v0.0.4

func (c *Client) ListAuthoredCourses(ctx context.Context) ([]Course, error)

func (*Client) ListAuthoredTutorials added in v0.0.4

func (c *Client) ListAuthoredTutorials(ctx context.Context) ([]Tutorial, error)

func (*Client) ListAuthors added in v0.0.4

func (c *Client) ListAuthors(ctx context.Context, filter ListAuthorsFilter) ([]Author, error)

func (*Client) ListChallenges added in v0.0.4

func (c *Client) ListChallenges(ctx context.Context) ([]Challenge, error)

func (*Client) ListContentFiles added in v0.0.4

func (c *Client) ListContentFiles(
	ctx context.Context,
	kind content.ContentKind,
	name string,
) ([]string, error)

func (*Client) ListCourses added in v0.0.4

func (c *Client) ListCourses(ctx context.Context) ([]Course, error)

func (*Client) ListPlaygrounds

func (c *Client) ListPlaygrounds(ctx context.Context) ([]Playground, error)

func (*Client) ListPlays

func (c *Client) ListPlays(ctx context.Context) ([]*Play, error)

func (*Client) ListTutorials added in v0.0.4

func (c *Client) ListTutorials(ctx context.Context) ([]Tutorial, error)

func (*Client) Post

func (c *Client) Post(
	ctx context.Context,
	path string,
	query url.Values,
	headers http.Header,
	body io.Reader,
) (*http.Response, error)

func (*Client) PostInto

func (c *Client) PostInto(
	ctx context.Context,
	path string,
	query url.Values,
	headers http.Header,
	body io.Reader,
	into any,
) error

func (*Client) Put added in v0.0.4

func (c *Client) Put(
	ctx context.Context,
	path string,
	query url.Values,
	headers http.Header,
	body io.Reader,
) (*http.Response, error)

func (*Client) PutContentMarkdown added in v0.0.4

func (c *Client) PutContentMarkdown(
	ctx context.Context,
	kind content.ContentKind,
	name string,
	file string,
	content string,
) error

func (*Client) PutInto added in v0.0.4

func (c *Client) PutInto(
	ctx context.Context,
	path string,
	query url.Values,
	headers http.Header,
	body io.Reader,
	into any,
) error

func (*Client) SetCredentials

func (c *Client) SetCredentials(sessionID, accessToken string)

func (*Client) StartTunnel

func (c *Client) StartTunnel(ctx context.Context, id string, req StartTunnelRequest) (*StartTunnelResponse, error)

func (*Client) Upload added in v0.0.4

func (c *Client) Upload(
	ctx context.Context,
	url string,
	src io.Reader,
) (*http.Response, error)

func (*Client) UploadContentFile added in v0.0.4

func (c *Client) UploadContentFile(
	ctx context.Context,
	kind content.ContentKind,
	name string,
	file string,
	src string,
) error

func (*Client) UploadFrom added in v0.0.4

func (c *Client) UploadFrom(
	ctx context.Context,
	url string,
	file string,
) (*http.Response, error)

type ClientOptions

type ClientOptions struct {
	BaseURL     string
	APIBaseURL  string
	SessionID   string
	AccessToken string
	UserAgent   string
}

type Course added in v0.0.4

type Course struct {
	CreatedAt string `json:"createdAt" yaml:"createdAt"`
	UpdatedAt string `json:"updatedAt" yaml:"updatedAt"`

	Name string `json:"name" yaml:"name"`

	PageURL string `json:"pageUrl" yaml:"pageUrl"`
}

func (*Course) GetKind added in v0.0.4

func (c *Course) GetKind() content.ContentKind

func (*Course) GetName added in v0.0.4

func (c *Course) GetName() string

func (*Course) GetPageURL added in v0.0.4

func (c *Course) GetPageURL() string

type CourseVariant added in v0.0.4

type CourseVariant string
const (
	CourseVariantSimple  CourseVariant = "simple"
	CourseVariantModular CourseVariant = "modular"
)

type CreateAuthorRequest added in v0.0.4

type CreateAuthorRequest struct {
	Author
}

type CreateChallengeRequest added in v0.0.4

type CreateChallengeRequest struct {
	Name string `json:"name"`
}

type CreateCourseRequest added in v0.0.4

type CreateCourseRequest struct {
	Name    string        `json:"name"`
	Variant CourseVariant `json:"variant"`
}

type CreatePlayRequest

type CreatePlayRequest struct {
	Playground string `json:"playground"`
}

type CreateTutorialRequest added in v0.0.4

type CreateTutorialRequest struct {
	Name string `json:"name"`
}

type ListAuthorsFilter added in v0.0.4

type ListAuthorsFilter struct {
	UserID []string
}

type Machine

type Machine struct {
	Name        string `json:"name"`
	CPUCount    int    `json:"cpuCount"`
	RAMSize     string `json:"ramSize"`
	DrivePerf   string `json:"drivePerf"`
	NetworkPerf string `json:"networkPerf"`
}

type Me

type Me struct {
	ID string `json:"id" yaml:"userId"`

	GithubProfileId string `json:"githubProfileId" yaml:"githubProfileId"`

	PremiumAccess *PremiumAccess `json:"premiumAccess,omitempty" yaml:"premiumAccess,omitempty"`
}

type Play

type Play struct {
	ID string `json:"id" yaml:"id"`

	CreatedAt   string `json:"createdAt" yaml:"createdAt"`
	UpdatedAt   string `json:"updatedAt" yaml:"updatedAt"`
	LastStateAt string `json:"lastStateAt" yaml:"lastStateAt"`

	ExpiresIn int `json:"expiresIn" yaml:"expiresIn"`

	Playground Playground `json:"playground" yaml:"playground"`

	TutorialName string `json:"tutorialName,omitempty" yaml:"tutorialName"`

	Tutorial *struct {
		Name  string `json:"name" yaml:"name"`
		Title string `json:"title" yaml:"title"`
	} `json:"tutorial,omitempty" yaml:"tutorial"`

	ChallengeName string `json:"challengeName,omitempty" yaml:"challengeName"`

	Challenge *struct {
		Name  string `json:"name" yaml:"name"`
		Title string `json:"title" yaml:"title"`
	} `json:"challenge,omitempty" yaml:"challenge"`

	CourseName string `json:"courseName,omitempty" yaml:"courseName"`

	Course *struct {
		Name  string `json:"name" yaml:"name"`
		Title string `json:"title" yaml:"title"`
	} `json:"course,omitempty" yaml:"course"`

	LessonPath string `json:"lessonPath,omitempty" yaml:"lessonPath"`

	Lesson *struct {
		Name  string `json:"name" yaml:"name"`
		Title string `json:"title" yaml:"title"`
	} `json:"lesson,omitempty" yaml:"lesson"`

	PageURL string `json:"pageUrl" yaml:"pageUrl"`

	Active    bool `json:"active" yaml:"active"`
	Running   bool `json:"running" yaml:"running"`
	Destroyed bool `json:"destroyed" yaml:"destroyed"`
	Failed    bool `json:"failed" yaml:"failed"`

	Machines []Machine `json:"machines" yaml:"machines"`
}

func (*Play) GetMachine

func (p *Play) GetMachine(name string) *Machine

type Playground

type Playground struct {
	Name        string   `json:"name"`
	Title       string   `json:"title"`
	Description string   `json:"description"`
	Categories  []string `json:"categories"`
}

type PortAccess

type PortAccess string
const (
	PortAccessPublic  PortAccess = "public"
	PortAccessPrivate PortAccess = "private"
)

type PremiumAccess added in v0.0.4

type PremiumAccess struct {
	Until    string `json:"until,omitempty" yaml:"until,omitempty"`
	Lifetime bool   `json:"lifetime,omitempty" yaml:"lifetime,omitempty"`
	Trial    bool   `json:"trial,omitempty" yaml:"trial,omitempty"`
}

type Session

type Session struct {
	ID string `json:"id"`

	UserID string `json:"userId"`

	Authenticated bool `json:"authenticated"`

	AccessToken string `json:"accessToken"`

	AuthURL string `json:"authUrl"`
}

type StartTunnelRequest

type StartTunnelRequest struct {
	Machine          string     `json:"machine"`
	Port             int        `json:"port"`
	Access           PortAccess `json:"access"`
	GenerateLoginURL bool       `json:"generateLoginUrl"`
	SSHPubKey        string     `json:"sshPubKey"`
}

type StartTunnelResponse

type StartTunnelResponse struct {
	URL      string `json:"url"`
	LoginURL string `json:"loginUrl"`
}

type Tutorial added in v0.0.4

type Tutorial struct {
	CreatedAt string `json:"createdAt"`
	UpdatedAt string `json:"updatedAt"`

	Name string `json:"name"`

	PageURL string `json:"pageUrl"`
}

func (*Tutorial) GetKind added in v0.0.4

func (t *Tutorial) GetKind() content.ContentKind

func (*Tutorial) GetName added in v0.0.4

func (t *Tutorial) GetName() string

func (*Tutorial) GetPageURL added in v0.0.4

func (t *Tutorial) GetPageURL() string

Jump to

Keyboard shortcuts

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