artifact

package
v1.0.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2023 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeaderAccessControlAllowOrigin      = "Access-Control-Allow-Origin"
	HeaderAccessControlAllowMethods     = "Access-Control-Allow-Methods"
	HeaderAccessControlAllowHeaders     = "Access-Control-Allow-Headers"
	HeaderAccessControlAllowCredentials = "Access-Control-Allow-Credentials"
)

Variables

View Source
var (
	ErrMissingOpts = errors.New("missing required options")
)

Functions

This section is empty.

Types

type AnalysisArtifactsRequest

type AnalysisArtifactsRequest struct {
	RunID      string   `json:"run_id"`
	Shortcode  string   `json:"shortcode"`
	SnippetIDs []string `json:"snippet_ids"`
}

type AutofixArtifactsRequest

type AutofixArtifactsRequest struct {
	RunID      string              `json:"run_id"`
	Shortcode  string              `json:"shortcode"`
	SnippetIDs map[string][]string `json:"snippet_ids"`
}

type AutofixResultObject

type AutofixResultObject struct {
	BeforeHTML string `json:"before_html"`
	AfterHTML  string `json:"after_html"`
}

type Facade

type Facade struct {
	ArtifactHandler *Handler
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, opts *Opts) (*Facade, error)

func (*Facade) AddRoutes

func (f *Facade) AddRoutes(router Router, m []echo.MiddlewareFunc) Router

type Handler

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

func NewHandler

func NewHandler(storage StorageClient, bucket string) *Handler

func (*Handler) HandleAnalysis

func (h *Handler) HandleAnalysis(c echo.Context) error

HandleAnalysisArtifacts handles reading and parsing the body of the POST request to `/artifacts/analysis` endpoint.

func (*Handler) HandleAutofix

func (h *Handler) HandleAutofix(c echo.Context) error

HandleAutofixArtifacts handles reading and parsing the body of the POST request to /artifacts/autofix endpoint.

type Opts

type Opts struct {
	AllowedOrigin string // For CORS
	Bucket        string
	Storage       StorageClient
}

type Router

type Router interface {
	AddRoute(method string, path string, handlerFunc echo.HandlerFunc, middleware ...echo.MiddlewareFunc)
}

type StorageClient

type StorageClient interface {
	// UploadDir(string, string) error
	// UploadObjects(string, ...string) error
	// GetDir(string, string) error
	// GetObjects(string, string, ...string) error
	NewReader(context.Context, string, string) (io.ReadCloser, error)
}

Jump to

Keyboard shortcuts

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