Files
gitea-pages/pkg/core/backend.go
2025-11-11 10:13:53 +08:00

24 lines
612 B
Go

package core
import (
"context"
"io"
"net/http"
"time"
)
type BranchInfo struct {
ID string `json:"id"`
LastModified time.Time `json:"last_modified"`
}
type Backend interface {
io.Closer
// Repos return repo name + default branch
Repos(ctx context.Context, owner string) (map[string]string, error)
// Branches return branch + commit id
Branches(ctx context.Context, owner, repo string) (map[string]*BranchInfo, error)
// Open return file or error (error)
Open(ctx context.Context, client *http.Client, owner, repo, commit, path string, headers http.Header) (*http.Response, error)
}