client

package
v0.14.2 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCannotUseGuest = errors.New("cannot use guest client for this operation")
View Source
var ErrInvalidClient = errors.New("invalid client")

Functions

This section is empty.

Types

type AuthorizedRoundTripper

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

func (*AuthorizedRoundTripper) RoundTrip

func (a *AuthorizedRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

type Client

type Client interface {
	WhoAmI(ctx context.Context) (string, error)
	GenerateRunbookV2(ctx context.Context, commands []RecordedCommand) (*GeneratedRunbook, error)
	// Deprecated. Use GenerateRunbookV2 instead
	GenerateRunbook(ctx context.Context, commands []string) (*GeneratedRunbook, error)
	RunbookByID(ctx context.Context, id string) (*Runbook, error)
	Runbooks(ctx context.Context) ([]RunbookInfo, error)
	Ask(ctx context.Context, question QuestionInfo) (*Runbook, error)
	SaveRunbook(ctx context.Context, runbook *Runbook) (*GeneratedRunbook, error)
	Explain(ctx context.Context, code CodeInfo) (<-chan string, error)
	StepContentByStepID(ctx context.Context, stepID string) (*StepContent, error)
}

func New

func New() (Client, error)

func NewGuest added in v0.9.0

func NewGuest() Client

type CodeInfo added in v0.9.12

type CodeInfo struct {
	Code     string            `json:"code"`
	Tags     map[string]string `json:"tags,omitempty"`
	FileData []byte            `json:"file_data,omitempty"`
	FileName string            `json:"file_name,omitempty"`
}

type ErrorResponse added in v0.9.0

type ErrorResponse struct {
	Message string `json:"message"`
}

type FileInfo added in v0.10.0

type FileInfo struct {
	Mode    fs.FileMode `json:"mode,omitempty"`
	Content []byte      `json:"content,omitempty"`
	Path    string      `json:"path,omitempty"`
}

type GeneratedRunbook

type GeneratedRunbook struct {
	Runbook Runbook `json:"runbook"`
	URL     string  `json:"url"`
}

type GuestRoundTripper added in v0.9.0

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

func (*GuestRoundTripper) RoundTrip added in v0.9.0

func (g *GuestRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

type QuestionInfo added in v0.9.5

type QuestionInfo struct {
	Question          string            `json:"question"`
	Tags              map[string]string `json:"tags,omitempty"`
	FileData          []byte            `json:"file_data,omitempty"`
	FileName          string            `json:"file_name,omitempty"`
	PreviousQuestions []string          `json:"previous_questions,omitempty"`
}

type RecordedCommand added in v0.8.2

type RecordedCommand struct {
	Command  string    `json:"command"`
	Prompt   string    `json:"prompt,omitempty"`
	FileInfo *FileInfo `json:"file_info,omitempty"`
}

type Runbook

type Runbook struct {
	RunbookID string `json:"runbook_id"`
	Title     string `json:"title"`
	Steps     []Step `json:"steps"`
}

func (*Runbook) Commands added in v0.9.0

func (rb *Runbook) Commands() []string

type RunbookInfo added in v0.9.1

type RunbookInfo struct {
	RunbookID string `json:"runbook_id"`
	Title     string `json:"title"`
}

type Step

type Step struct {
	Type        StepTypeEnum `json:"type"`
	Description string       `json:"description"`
	Command     string       `json:"command"`
}

type StepContent added in v0.10.0

type StepContent struct {
	Content []byte      `json:"content"`
	Mode    fs.FileMode `json:"mode"`
	Name    string      `json:"name"`
	DirPath string      `json:"dir_path"`
}

func (*StepContent) UnmarshalJSON added in v0.10.0

func (sc *StepContent) UnmarshalJSON(data []byte) error

UnmarshalJSON is a custom unmarshaler for StepContent that handles the mode as a float64.

type StepTypeEnum added in v0.10.0

type StepTypeEnum string
const (
	StepTypeCode StepTypeEnum = "code"
	StepTypeFile StepTypeEnum = "file"
)

Jump to

Keyboard shortcuts

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