api

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GithubHost = "github.com"
	GitlabHost = "gitlab.com"
)
View Source
const (
	HTTPRequestValidationFailed = "HTTP Request Validation failed."
	UnknownGitProviderError     = "An error occured during Git Provider request."
)
View Source
const (
	RawMimeTypes string = "application/vnd.giteway.raw"
)

Variables

View Source
var NewError = func(status int, msg string) StatusError {
	return &ErrorModel{
		Status: status,
		Title:  http.StatusText(status),
		Detail: msg,
	}
}

Functions

func HostingMiddleware added in v0.1.4

func HostingMiddleware(githubService *github.GithubService) gin.HandlerFunc

func OwnerMiddleware added in v0.1.4

func OwnerMiddleware() gin.HandlerFunc

func PathMiddleware added in v0.1.4

func PathMiddleware() gin.HandlerFunc

func RepoMiddleware added in v0.1.4

func RepoMiddleware() gin.HandlerFunc

func RespondError added in v0.1.4

func RespondError(ctx *gin.Context, status int, msg string, errs ...error)

func RespondJSON added in v0.1.4

func RespondJSON(c *gin.Context, status int, payload interface{})

func Routes

func Routes(r *gin.Engine, h *Handler, githubService *github.GithubService)

Types

type CommitForm added in v0.1.0

type CommitForm struct {
	Message *string `form:"message,omitempty" json:"message,omitempty"`
}

type ContentTypeFilter added in v0.1.2

type ContentTypeFilter interface {
	ContentType(string) string
}

type CreateBranchForm added in v0.1.0

type CreateBranchForm struct {
	Name string `uri:"name" binding:"required"`
}

type DeleteBranchUri added in v0.1.0

type DeleteBranchUri struct {
	Branch string `uri:"branch" binding:"required"`
}

type ErrorModel added in v0.1.2

type ErrorModel struct {
	Type   string `json:"type,omitempty"`
	Title  string `json:"title,omitempty"`
	Status int    `json:"status,omitempty"`
	Detail string `json:"detail,omitempty"`
}

https://datatracker.ietf.org/doc/html/rfc7807

func (*ErrorModel) Error added in v0.1.2

func (e *ErrorModel) Error() string

func (*ErrorModel) GetStatus added in v0.1.2

func (e *ErrorModel) GetStatus() int

type FileContentForm added in v0.1.0

type FileContentForm struct {
	Encoding string     `form:"encoding,default=text" json:"encoding"`
	Content  string     `form:"content" json:"content" binding:"required"`
	Commit   CommitForm `form:"commit,omitempty" json:"commit,omitempty"`
}

type FileURI

type FileURI struct {
	Path string `uri:"path,default=/"`
}

type Handler

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

func NewHandler

func NewHandler(cfg *config.Config, e *gin.Engine) *Handler

func (*Handler) CreateBranch added in v0.1.0

func (h *Handler) CreateBranch(ctx *gin.Context)

func (*Handler) CreateFile added in v0.1.0

func (h *Handler) CreateFile(ctx *gin.Context)

func (*Handler) DeleteBranch added in v0.1.0

func (h *Handler) DeleteBranch(ctx *gin.Context)

func (*Handler) DeleteFile added in v0.1.0

func (h *Handler) DeleteFile(ctx *gin.Context)

func (*Handler) GetBranches

func (h *Handler) GetBranches(ctx *gin.Context)

func (*Handler) GetCommits

func (h *Handler) GetCommits(ctx *gin.Context)

func (*Handler) GetFiles

func (h *Handler) GetFiles(ctx *gin.Context)

func (*Handler) GetRepositories

func (h *Handler) GetRepositories(ctx *gin.Context)

func (*Handler) GetRepository

func (h *Handler) GetRepository(ctx *gin.Context)

func (*Handler) UpdateFile added in v0.1.0

func (h *Handler) UpdateFile(ctx *gin.Context)

type RefForm added in v0.1.0

type RefForm struct {
	Ref    *string `form:"ref,omitempty"`
	SHA    *string `form:"sha,omitempty"`
	Branch string  `form:"branch,default=main"`
}

type StatusError added in v0.1.2

type StatusError interface {
	GetStatus() int
	Error() string
}

Jump to

Keyboard shortcuts

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