Documentation ¶
Index ¶
- Constants
- Variables
- type API
- func (a *API) AuthorizedKeys(ctx context.Context, user string) ([]byte, error)
- func (a *API) CreateCodespace(ctx context.Context, params *CreateCodespaceParams) (*Codespace, error)
- func (a *API) DeleteCodespace(ctx context.Context, codespaceName string) error
- func (a *API) GetCodespace(ctx context.Context, codespaceName string, includeConnection bool) (*Codespace, error)
- func (a *API) GetCodespaceRegionLocation(ctx context.Context) (string, error)
- func (a *API) GetCodespaceRepositoryContents(ctx context.Context, codespace *Codespace, path string) ([]byte, error)
- func (a *API) GetCodespacesMachines(ctx context.Context, repoID int, branch, location string) ([]*Machine, error)
- func (a *API) GetRepository(ctx context.Context, nwo string) (*Repository, error)
- func (a *API) GetUser(ctx context.Context) (*User, error)
- func (a *API) ListCodespaces(ctx context.Context, limit int) (codespaces []*Codespace, err error)
- func (a *API) StartCodespace(ctx context.Context, codespaceName string) error
- func (a *API) StopCodespace(ctx context.Context, codespaceName string) error
- type Codespace
- type CodespaceConnection
- type CodespaceGitStatus
- type CreateCodespaceParams
- type Machine
- type Repository
- type User
Constants ¶
const ( // CodespaceStateAvailable is the state for a running codespace environment. CodespaceStateAvailable = "Available" // CodespaceStateShutdown is the state for a shutdown codespace environment. CodespaceStateShutdown = "Shutdown" // CodespaceStateStarting is the state for a starting codespace environment. CodespaceStateStarting = "Starting" )
Variables ¶
var CodespaceFields = []string{
"name",
"owner",
"repository",
"state",
"gitStatus",
"createdAt",
"lastUsedAt",
}
CodespaceFields is the list of exportable fields for a codespace.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API is the interface to the codespace service.
func New ¶
New creates a new API client connecting to the configured endpoints with the HTTP client.
func (*API) AuthorizedKeys ¶
AuthorizedKeys returns the public keys (in ~/.ssh/authorized_keys format) registered by the specified GitHub user.
func (*API) CreateCodespace ¶
func (a *API) CreateCodespace(ctx context.Context, params *CreateCodespaceParams) (*Codespace, error)
CreateCodespace creates a codespace with the given parameters and returns a non-nil error if it fails to create.
func (*API) DeleteCodespace ¶
DeleteCodespace deletes the given codespace.
func (*API) GetCodespace ¶
func (a *API) GetCodespace(ctx context.Context, codespaceName string, includeConnection bool) (*Codespace, error)
GetCodespace returns the user codespace based on the provided name. If the codespace is not found, an error is returned. If includeConnection is true, it will return the connection information for the codespace.
func (*API) GetCodespaceRegionLocation ¶
GetCodespaceRegionLocation returns the closest codespace location for the user.
func (*API) GetCodespaceRepositoryContents ¶
func (*API) GetCodespacesMachines ¶
func (a *API) GetCodespacesMachines(ctx context.Context, repoID int, branch, location string) ([]*Machine, error)
GetCodespacesMachines returns the codespaces machines for the given repo, branch and location.
func (*API) GetRepository ¶
GetRepository returns the repository associated with the given owner and name.
func (*API) ListCodespaces ¶
ListCodespaces returns a list of codespaces for the user. Pass a negative limit to request all pages from the API until all codespaces have been fetched.
func (*API) StartCodespace ¶
StartCodespace starts a codespace for the user. If the codespace is already running, the returned error from the API is ignored.
type Codespace ¶
type Codespace struct { Name string `json:"name"` CreatedAt string `json:"created_at"` LastUsedAt string `json:"last_used_at"` Owner User `json:"owner"` Repository Repository `json:"repository"` State string `json:"state"` GitStatus CodespaceGitStatus `json:"git_status"` Connection CodespaceConnection `json:"connection"` }
Codespace represents a codespace.
func (*Codespace) ExportData ¶ added in v2.2.0
type CodespaceConnection ¶
type CodespaceGitStatus ¶ added in v2.2.0
type CreateCodespaceParams ¶
type CreateCodespaceParams struct { RepositoryID int IdleTimeoutMinutes int Branch string Machine string Location string }
CreateCodespaceParams are the required parameters for provisioning a Codespace.
type Repository ¶
type Repository struct { ID int `json:"id"` FullName string `json:"full_name"` DefaultBranch string `json:"default_branch"` }
Repository represents a GitHub repository.