Documentation
¶
Index ¶
- Constants
- Variables
- func PathParamToID(r *http.Request, param string) (id [32]byte, err error)
- func QueryParamToInt64(r *http.Request, param string, min, def int64) (int64, error)
- func QueryParamToSortKeys(r *http.Request, param, def string) ([]string, error)
- func QueryParamToString(r *http.Request, param string) (string, bool, error)
- func QueryParamToUint32(r *http.Request, param string, min, def uint32) (uint32, error)
- func SetupRoutes(server *http.ServeMux, repo *repository.Repository, ctx *appcontext.AppContext, ...)
- func SnapshotPathParam(r *http.Request, repo *repository.Repository, param string) (objects.MAC, string, error)
- func TokenAuthMiddleware(token string) func(http.Handler) http.Handler
- type APIView
- type AlertServiceConfiguration
- type ApiError
- type ApiErrorRes
- type DownloadItem
- type DownloadQuery
- type IntegrationsInstallRequest
- type IntegrationsMessage
- type IntegrationsResponse
- type Item
- type Items
- type ItemsPage
- type JSONAPIView
- type LoginRequestEmail
- type LoginRequestGithub
- type ParamErrorType
- type ParameterError
- type RepositoryInfoResponse
- type RepositoryInfoSnapshots
- type SnapshotReaderURLSigner
- type SnapshotSignedURLClaims
- type TimelineLocation
- type TokenResponse
Constants ¶
View Source
const ( InvalidArgument ParamErrorType = "invalid_argument" BadNumber = "bad_number" MissingArgument = "missing_argument" )
Variables ¶
View Source
var ( ErrNumberOutOfRange = errors.New("Number out of range") ErrMissingField = errors.New("Missing field") ErrInvalidID = errors.New("Invalid ID") ErrInvalidSortKey = errors.New("Invalid sort key") )
View Source
var SERVICES_ENDPOINT = "https://api.plakar.io"
Functions ¶
func QueryParamToInt64 ¶
func QueryParamToSortKeys ¶
func QueryParamToString ¶
func QueryParamToUint32 ¶
func SetupRoutes ¶
func SetupRoutes(server *http.ServeMux, repo *repository.Repository, ctx *appcontext.AppContext, token string)
func SnapshotPathParam ¶
func SnapshotPathParam(r *http.Request, repo *repository.Repository, param string) (objects.MAC, string, error)
Parse a URL parameter with the format "snapshotID:path".
Types ¶
type ApiError ¶
type ApiError struct {
HttpCode int `json:"-"`
ErrCode string `json:"code"`
Message string `json:"message"`
Params map[string]ParameterError `json:"params,omitempty"`
}
type ApiErrorRes ¶
type ApiErrorRes struct {
Error *ApiError `json:"error"`
}
type DownloadItem ¶
type DownloadItem struct {
Pathname string `json:"pathname"`
}
type DownloadQuery ¶
type DownloadQuery struct {
Name string `json:"name"`
Items []DownloadItem `json:"items"`
Rebase bool `json:"rebase,omitempty"`
}
type IntegrationsInstallRequest ¶ added in v1.0.3
type IntegrationsMessage ¶ added in v1.0.3
type IntegrationsResponse ¶ added in v1.0.3
type IntegrationsResponse struct {
Type string `json:"type"`
Status string `json:"status"`
StartedAt time.Time `json:"started_at"`
FinishedAt time.Time `json:"finished_at"`
Messages []IntegrationsMessage `json:"messages"`
}
func NewIntegrationsResponse ¶ added in v1.0.3
func NewIntegrationsResponse(Type string) *IntegrationsResponse
func (*IntegrationsResponse) AddMessage ¶ added in v1.0.3
func (r *IntegrationsResponse) AddMessage(msg string)
type JSONAPIView ¶
type JSONAPIView func(w http.ResponseWriter, r *http.Request) error
func (JSONAPIView) ServeHTTP ¶
func (view JSONAPIView) ServeHTTP(w http.ResponseWriter, r *http.Request)
type LoginRequestEmail ¶
type LoginRequestGithub ¶
type LoginRequestGithub struct {
Redirect string `json:"redirect"`
}
type ParamErrorType ¶
type ParamErrorType string
type ParameterError ¶
type ParameterError struct {
Code ParamErrorType `json:"code"`
Message string `json:"message"`
}
type RepositoryInfoResponse ¶
type RepositoryInfoResponse struct {
Location string `json:"location"`
Snapshots RepositoryInfoSnapshots `json:"snapshots"`
Configuration storage.Configuration `json:"configuration"`
OS string `json:"os"`
Arch string `json:"arch"`
}
type RepositoryInfoSnapshots ¶
type SnapshotReaderURLSigner ¶
type SnapshotReaderURLSigner struct {
// contains filtered or unexported fields
}
func NewSnapshotReaderURLSigner ¶
func NewSnapshotReaderURLSigner(ui *uiserver, token string) SnapshotReaderURLSigner
func (SnapshotReaderURLSigner) Sign ¶
func (signer SnapshotReaderURLSigner) Sign(w http.ResponseWriter, r *http.Request) error
func (SnapshotReaderURLSigner) VerifyMiddleware ¶
func (signer SnapshotReaderURLSigner) VerifyMiddleware(next http.Handler) http.Handler
VerifyMiddleware is a middleware that checks if the request to read the file content is authorized. It checks if the ?signature query parameter is valid. If it is not valid, it falls back to the Authorization header.
type SnapshotSignedURLClaims ¶
type SnapshotSignedURLClaims struct {
SnapshotID string `json:"snapshot_id"`
Path string `json:"path"`
jwt.RegisteredClaims
}
type TimelineLocation ¶
type TokenResponse ¶
type TokenResponse struct {
Token string `json:"token"`
}
Click to show internal directories.
Click to hide internal directories.