Documentation
¶
Index ¶
- Constants
- Variables
- func BindHealthzRoute(rg *router.Router[*core.RequestEvent])
- func BodyLimit(limitBytes int64) *hook.Handler[*core.RequestEvent]
- func CORS(config CORSConfig) *hook.Handler[*core.RequestEvent]
- func DefaultInstallerFunc(app core.App, systemSuperuser *core.Record, baseURL string) error
- func EnrichRecord(e *core.RequestEvent, record *core.Record, defaultExpands ...string) error
- func EnrichRecords(e *core.RequestEvent, records []*core.Record, defaultExpands ...string) error
- func Gzip() *hook.Handler[*core.RequestEvent]
- func GzipWithConfig(config GzipConfig) *hook.Handler[*core.RequestEvent]
- func MustSubFS(fsys fs.FS, dir string) fs.FS
- func NewApiError(status int, message string, errData any) *router.ApiError
- func NewBadRequestError(message string, errData any) *router.ApiError
- func NewForbiddenError(message string, errData any) *router.ApiError
- func NewInternalServerError(message string, errData any) *router.ApiError
- func NewNotFoundError(message string, errData any) *router.ApiError
- func NewRouter(app core.App) (*router.Router[*core.RequestEvent], error)
- func NewTooManyRequestsError(message string, errData any) *router.ApiError
- func NewUnauthorizedError(message string, errData any) *router.ApiError
- func RecordAuthResponse(e *core.RequestEvent, authRecord *core.Record, authMethod string, meta any) error
- func RequireAuth(optCollectionNames ...string) *hook.Handler[*core.RequestEvent]
- func RequireGuestOnly() *hook.Handler[*core.RequestEvent]
- func RequireSameCollectionContextAuth(collectionPathParam string) *hook.Handler[*core.RequestEvent]
- func RequireSuperuserAuth() *hook.Handler[*core.RequestEvent]
- func RequireSuperuserOrOwnerAuth(ownerIdPathParam string) *hook.Handler[*core.RequestEvent]
- func Serve(app core.App, config ServeConfig) error
- func SkipSuccessActivityLog() *hook.Handler[*core.RequestEvent]
- func StatedOrg(e *core.RequestEvent) string
- func Static(fsys fs.FS, indexFallback bool) func(*core.RequestEvent) error
- func ToApiError(err error) *router.ApiError
- func WrapStdHandler(h http.Handler) func(*core.RequestEvent) error
- func WrapStdMiddleware(m func(http.Handler) http.Handler) func(*core.RequestEvent) error
- type Bases
- type BatchActionHandlerFunc
- type BatchRequestResult
- type BatchResponseError
- type CORSConfig
- type GzipConfig
- type HandleFunc
- type RetryConfig
- type ServeConfig
- type TaskClaimRequest
- type TaskCompleteRequest
- type TaskCreateRequest
- type TaskFailRequest
- type TaskNextRequest
- type TaskProgressRequest
- type TaskSignalRequest
- type TaskUpdateRequest
- type WorkflowCreateRequest
Constants ¶
const ( RequestEventKeyLogMeta = "baseLogMeta" // extra data to store with the request activity log // RequestEventKeyOrgs carries the org slugs the verified token asserts, as // []string. Set by resolveJWKSToken; read by anything that answers a // per-org question. RequestEventKeyOrgs = "authOrgs" // RequestEventKeyOrg carries the one org the request acts in, as a string — // the org resolved from the verified token, and the org whose Base is // serving. Set by resolveJWKSToken. RequestEventKeyOrg = "authOrg" // RequestEventKeySub carries the subject the credential names, as a string. // Every door that resolves a credential sets it, which is what lets anything // downstream name the caller without knowing which door it came through — an // IAM key mints no auth record, so e.Auth answers nothing for one. RequestEventKeySub = "authSub" // RequestEventKeyOrgAdmin reports, as a bool, whether the credential carries // authority over the org it acts in rather than only over its own subject. // A member's token is not that; an org admin's token and an org's secret key // are. Set by whichever door resolved the credential. RequestEventKeyOrgAdmin = "authOrgAdmin" )
Common request event store keys used by the middlewares and api handlers.
const ( DefaultWWWRedirectMiddlewarePriority = -99999 DefaultWWWRedirectMiddlewareId = "baseWWWRedirect" DefaultActivityLoggerMiddlewarePriority = DefaultRateLimitMiddlewarePriority - 40 DefaultActivityLoggerMiddlewareId = "baseActivityLogger" DefaultSkipSuccessActivityLogMiddlewareId = "baseSkipSuccessActivityLog" DefaultEnableAuthIdActivityLog = "baseEnableAuthIdActivityLog" DefaultPanicRecoverMiddlewarePriority = DefaultRateLimitMiddlewarePriority - 30 DefaultPanicRecoverMiddlewareId = "basePanicRecover" DefaultLoadAuthTokenMiddlewarePriority = DefaultRateLimitMiddlewarePriority - 20 DefaultLoadAuthTokenMiddlewareId = "baseLoadAuthToken" DefaultSecurityHeadersMiddlewarePriority = DefaultRateLimitMiddlewarePriority - 10 DefaultSecurityHeadersMiddlewareId = "baseSecurityHeaders" DefaultRequireGuestOnlyMiddlewareId = "baseRequireGuestOnly" DefaultRequireAuthMiddlewareId = "baseRequireAuth" DefaultRequireSuperuserAuthMiddlewareId = "baseRequireSuperuserAuth" DefaultRequireSuperuserOrOwnerAuthMiddlewareId = "baseRequireSuperuserOrOwnerAuth" DefaultRequireSameCollectionContextAuthMiddlewareId = "baseRequireSameCollectionContextAuth" )
const ( // StoreKeyJWKSURL is the JWKS endpoint URL for the identity provider // (e.g., "https://auth.example.com/v1/iam/.well-known/jwks"). // When set, loadAuthToken validates bearer tokens against this endpoint. StoreKeyJWKSURL = "jwksURL" // StoreKeyAuthUsersCollection is the name of the auth collection to // find/create externally-authenticated user records in (default: "users"). StoreKeyAuthUsersCollection = "authUsersCollection" // StoreKeyExternalAuthOnly controls whether the external identity // provider (OIDC/JWKS via Hanzo IAM) is the exclusive auth source. // In Hanzo Base this is always true once the platform plugin // registers — the legacy local-password / OTP / MFA / impersonate // surfaces have been removed (returning 404 from the router). // There is no exemption, _superusers included. StoreKeyExternalAuthOnly = "externalAuthOnly" // StoreKeyBases holds the [Bases] of the deployment. Set by the org plugin. StoreKeyBases = "bases" )
Store keys for OIDC/JWKS-based external auth provider integration. Set these via app.Store() from the platform plugin or manually.
const ( DefaultBodyLimitMiddlewareId = "baseBodyLimit" DefaultBodyLimitMiddlewarePriority = DefaultRateLimitMiddlewarePriority + 10 )
const ( DefaultCorsMiddlewareId = "baseCors" DefaultCorsMiddlewarePriority = DefaultActivityLoggerMiddlewarePriority - 1 // before the activity logger and rate limit so that OPTIONS preflight requests are not counted )
const ( DefaultRateLimitMiddlewareId = "baseRateLimit" DefaultRateLimitMiddlewarePriority = -1000 )
const (
DefaultGzipMiddlewareId = "baseGzip"
)
const DefaultMaxBodySize int64 = 32 << 20
const RealtimeClientAuthKey = "auth"
RealtimeClientAuthKey is the name of the realtime client store key that holds its auth state.
const StaticWildcardParam = "path"
StaticWildcardParam is the name of Static handler wildcard parameter.
Variables ¶
var DefaultCORSConfig = CORSConfig{ AllowOrigins: []string{"*"}, AllowMethods: []string{http.MethodGet, http.MethodHead, http.MethodPut, http.MethodPatch, http.MethodPost, http.MethodDelete}, }
DefaultCORSConfig is the default CORS middleware config.
var ErrRequestEntityTooLarge = router.NewApiError(http.StatusRequestEntityTooLarge, "Request entity too large", nil)
var ValidBatchActions = map[*regexp.Regexp]BatchActionHandlerFunc{ regexp.MustCompile(`^PUT /v1/collections/(?P<collection>[^\/\?]+)/records(?P<query>\?.*)?$`): func(app core.App, ir *core.InternalRequest, params map[string]string, next func(any) error) HandleFunc { var id string if len(ir.Body) > 0 && ir.Body["id"] != "" { id = cast.ToString(ir.Body["id"]) } if id != "" { _, err := app.FindRecordById(params["collection"], id) if err == nil { params["id"] = id ir.Method = "PATCH" ir.URL = "/v1/collections/" + params["collection"] + "/records/" + id + params["query"] return recordUpdate(false, next) } } ir.Method = "POST" ir.URL = "/v1/collections/" + params["collection"] + "/records" + params["query"] return recordCreate(false, next) }, regexp.MustCompile(`^POST /v1/collections/(?P<collection>[^\/\?]+)/records(\?.*)?$`): func(app core.App, ir *core.InternalRequest, params map[string]string, next func(any) error) HandleFunc { return recordCreate(false, next) }, regexp.MustCompile(`^PATCH /v1/collections/(?P<collection>[^\/\?]+)/records/(?P<id>[^\/\?]+)(\?.*)?$`): func(app core.App, ir *core.InternalRequest, params map[string]string, next func(any) error) HandleFunc { return recordUpdate(false, next) }, regexp.MustCompile(`^DELETE /v1/collections/(?P<collection>[^\/\?]+)/records/(?P<id>[^\/\?]+)(\?.*)?$`): func(app core.App, ir *core.InternalRequest, params map[string]string, next func(any) error) HandleFunc { return recordDelete(false, next) }, }
ValidBatchActions defines a map with the supported batch InternalRequest actions.
Note: when adding new routes make sure that their middlewares are inlined!
Functions ¶
func BindHealthzRoute ¶ added in v0.39.10
func BindHealthzRoute(rg *router.Router[*core.RequestEvent])
BindHealthzRoute registers health check endpoints. /healthz at root (platform standard) and /health under the API group.
func BodyLimit ¶
func BodyLimit(limitBytes int64) *hook.Handler[*core.RequestEvent]
BodyLimit returns a middleware handler that changes the default request body size limit.
If limitBytes <= 0, no limit is applied.
Otherwise, if the request body size exceeds the configured limitBytes, it sends 413 error response.
func CORS ¶
func CORS(config CORSConfig) *hook.Handler[*core.RequestEvent]
CORS returns a CORS middleware.
func DefaultInstallerFunc ¶
DefaultInstallerFunc tells an operator how to create the first superuser.
It only runs where IAM is NOT the auth source — with IAM on, loadInstaller returns before this and the superuser is whoever IAM issues an admin-claim token to.
It used to open a browser at `{baseURL}/_/#/baseinstal/{token}` and print that address. There is no such page: the admin was rewritten and serves no `baseinstal` route, so the link a first-boot operator was handed went nowhere, and the CLI line printed under it as a fallback was the only thing that worked. Now it is the instruction rather than the fallback.
func EnrichRecord ¶
EnrichRecord parses the request context and enrich the provided record:
- expands relations (if defaultExpands and/or ?expand query param is set)
- ensures that the emails of the auth record and its expanded auth relations are visible only for the current logged superuser, record owner or record with manage access
func EnrichRecords ¶
EnrichRecords parses the request context and enriches the provided records:
- expands relations (if defaultExpands and/or ?expand query param is set)
- ensures that the emails of the auth records and their expanded auth relations are visible only for the current logged superuser, record owner or record with manage access
Note: Expects all records to be from the same collection!
func Gzip ¶
func Gzip() *hook.Handler[*core.RequestEvent]
Gzip returns a middleware which compresses HTTP response using Gzip compression scheme.
func GzipWithConfig ¶
func GzipWithConfig(config GzipConfig) *hook.Handler[*core.RequestEvent]
GzipWithConfig returns a middleware which compresses HTTP response using gzip compression scheme.
func MustSubFS ¶
MustSubFS returns an fs.FS corresponding to the subtree rooted at fsys's dir.
This is similar to fs.Sub but panics on failure.
func NewApiError ¶
NewApiError is an alias for router.NewApiError.
func NewBadRequestError ¶
NewBadRequestError is an alias for router.NewBadRequestError.
func NewForbiddenError ¶
NewForbiddenError is an alias for router.NewForbiddenError.
func NewInternalServerError ¶
NewInternalServerError is an alias for router.NewInternalServerError.
func NewNotFoundError ¶
NewNotFoundError is an alias for router.NewNotFoundError.
func NewRouter ¶
NewRouter returns a new router instance loaded with the default app middlewares and api routes.
func NewTooManyRequestsError ¶
NewTooManyRequestsError is an alias for router.NewTooManyRequestsError.
func NewUnauthorizedError ¶
NewUnauthorizedError is an alias for router.NewUnauthorizedError.
func RecordAuthResponse ¶
func RecordAuthResponse(e *core.RequestEvent, authRecord *core.Record, authMethod string, meta any) error
RecordAuthResponse writes standardized json record auth response into the specified request context.
The authMethod argument specifies the name of the current authentication method (e.g. oauth2) and is forwarded to the OnRecordAuthRequest hook so callers can observe it. Hanzo IAM is the only auth source — Base no longer issues credentials or runs MFA/OTP/login-alert flows itself.
func RequireAuth ¶
func RequireAuth(optCollectionNames ...string) *hook.Handler[*core.RequestEvent]
RequireAuth middleware requires a request to have a valid record Authorization header.
The auth record could be from any collection. You can further filter the allowed record auth collections by specifying their names.
Example:
apis.RequireAuth() // any auth collection
apis.RequireAuth("_superusers", "users") // only the listed auth collections
func RequireGuestOnly ¶
func RequireGuestOnly() *hook.Handler[*core.RequestEvent]
RequireGuestOnly middleware requires a request to NOT have a valid Authorization header.
This middleware is the opposite of [apis.RequireAuth()].
func RequireSameCollectionContextAuth ¶
func RequireSameCollectionContextAuth(collectionPathParam string) *hook.Handler[*core.RequestEvent]
RequireSameCollectionContextAuth middleware requires a request to have a valid record Authorization header and the auth record's collection to match the one from the route path parameter (default to "collection" if collectionParam is empty).
func RequireSuperuserAuth ¶
func RequireSuperuserAuth() *hook.Handler[*core.RequestEvent]
RequireSuperuserAuth middleware requires a request to have a valid superuser Authorization header.
func RequireSuperuserOrOwnerAuth ¶
func RequireSuperuserOrOwnerAuth(ownerIdPathParam string) *hook.Handler[*core.RequestEvent]
RequireSuperuserOrOwnerAuth middleware requires a request to have a valid superuser or regular record owner Authorization header set.
This middleware is similar to [apis.RequireAuth()] but for the auth record token expects to have the same id as the path parameter ownerIdPathParam (default to "id" if empty).
func Serve ¶
func Serve(app core.App, config ServeConfig) error
Serve starts a new app web server.
NB! The app should be bootstrapped before starting the web server.
Example:
app.Bootstrap()
apis.Serve(app, apis.ServeConfig{
HttpAddr: "127.0.0.1:8080",
ShowStartBanner: false,
})
func SkipSuccessActivityLog ¶
func SkipSuccessActivityLog() *hook.Handler[*core.RequestEvent]
SkipSuccessActivityLog is a helper middleware that instructs the global activity logger to log only requests that have failed/returned an error.
func StatedOrg ¶ added in v1.5.25
func StatedOrg(e *core.RequestEvent) string
StatedOrg is the org a request SAID it meant, read off X-Org-Id before that header was deleted.
It is intent, not identity. Honor it only where the credential already carries the org, and refuse the request otherwise — a caller that names someone else's org and is handed its own reads the answer as that org's, and acts on it.
func Static ¶
Static is a handler function to serve static directory content from fsys.
If a file resource is missing and indexFallback is set, the request will be forwarded to the base index.html (useful for SPA with pretty urls).
NB! Expects the route to have a "{path...}" wildcard parameter.
Special redirects:
- if "path" is a file that ends in index.html, it is redirected to its non-index.html version (eg. /test/index.html -> /test/)
- if "path" is a directory that has index.html, the index.html file is rendered, otherwise if missing - returns 404 or fallback to the root index.html if indexFallback is set
Example:
fsys := os.DirFS("./public")
router.GET("/files/{path...}", apis.Static(fsys, false))
func ToApiError ¶
ToApiError wraps err into ApiError instance (if not already).
func WrapStdHandler ¶
func WrapStdHandler(h http.Handler) func(*core.RequestEvent) error
WrapStdHandler wraps Go http.Handler into a Base handler func.
func WrapStdMiddleware ¶
WrapStdMiddleware wraps Go [func(http.Handler) http.Handle] into a Base middleware func.
Types ¶
type Bases ¶ added in v1.5.25
Bases answers which Base serves an org.
One Base per org is the tenancy model whole, so this is the one lookup in it. A deployment that registers this has a Base per org; a deployment that does not has exactly one Base, the process's own, for everybody — a single-tenant Base with no other Base for a request to have missed.
type BatchActionHandlerFunc ¶
type BatchActionHandlerFunc func(app core.App, ir *core.InternalRequest, params map[string]string, next func(data any) error) HandleFunc
type BatchRequestResult ¶
type BatchResponseError ¶
type BatchResponseError struct {
// contains filtered or unexported fields
}
func (*BatchResponseError) Code ¶
func (e *BatchResponseError) Code() string
func (*BatchResponseError) Error ¶
func (e *BatchResponseError) Error() string
func (BatchResponseError) MarshalJSON ¶
func (e BatchResponseError) MarshalJSON() ([]byte, error)
type CORSConfig ¶
type CORSConfig struct {
// AllowOrigins determines the value of the Access-Control-Allow-Origin
// response header. This header defines a list of origins that may access the
// resource. The wildcard characters '*' and '?' are supported and are
// converted to regex fragments '.*' and '.' accordingly.
//
// Security: use extreme caution when handling the origin, and carefully
// validate any logic. Remember that attackers may register hostile domain names.
// See https://blog.portswigger.net/2016/10/exploiting-cors-misconfigurations-for.html
//
// Optional. Default value []string{"*"}.
//
// See also: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin
AllowOrigins []string
// AllowOriginFunc is a custom function to validate the origin. It takes the
// origin as an argument and returns true if allowed or false otherwise. If
// an error is returned, it is returned by the handler. If this option is
// set, AllowOrigins is ignored.
//
// Security: use extreme caution when handling the origin, and carefully
// validate any logic. Remember that attackers may register hostile domain names.
// See https://blog.portswigger.net/2016/10/exploiting-cors-misconfigurations-for.html
//
// Optional.
AllowOriginFunc func(origin string) (bool, error)
// AllowMethods determines the value of the Access-Control-Allow-Methods
// response header. This header specified the list of methods allowed when
// accessing the resource. This is used in response to a preflight request.
//
// Optional. Default value DefaultCORSConfig.AllowMethods.
//
// See also: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Methods
AllowMethods []string
// AllowHeaders determines the value of the Access-Control-Allow-Headers
// response header. This header is used in response to a preflight request to
// indicate which HTTP headers can be used when making the actual request.
//
// Optional. Default value []string{}.
//
// See also: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Headers
AllowHeaders []string
// AllowCredentials determines the value of the
// Access-Control-Allow-Credentials response header. This header indicates
// whether or not the response to the request can be exposed when the
// credentials mode (Request.credentials) is true. When used as part of a
// response to a preflight request, this indicates whether or not the actual
// request can be made using credentials. See also
// [MDN: Access-Control-Allow-Credentials].
//
// Optional. Default value false, in which case the header is not set.
//
// Security: avoid using `AllowCredentials = true` with `AllowOrigins = *`.
// See "Exploiting CORS misconfigurations for Bitcoins and bounties",
// https://blog.portswigger.net/2016/10/exploiting-cors-misconfigurations-for.html
//
// See also: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Credentials
AllowCredentials bool
// UnsafeWildcardOriginWithAllowCredentials UNSAFE/INSECURE: allows wildcard '*' origin to be used with AllowCredentials
// flag. In that case we consider any origin allowed and send it back to the client with `Access-Control-Allow-Origin` header.
//
// This is INSECURE and potentially leads to [cross-origin](https://portswigger.net/research/exploiting-cors-misconfigurations-for-bitcoins-and-bounties)
// attacks. See: https://github.com/labstack/echo/issues/2400 for discussion on the subject.
//
// Optional. Default value is false.
UnsafeWildcardOriginWithAllowCredentials bool
// ExposeHeaders determines the value of Access-Control-Expose-Headers, which
// defines a list of headers that clients are allowed to access.
//
// Optional. Default value []string{}, in which case the header is not set.
//
// See also: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Expose-Header
ExposeHeaders []string
// MaxAge determines the value of the Access-Control-Max-Age response header.
// This header indicates how long (in seconds) the results of a preflight
// request can be cached.
// The header is set only if MaxAge != 0, negative value sends "0" which instructs browsers not to cache that response.
//
// Optional. Default value 0 - meaning header is not sent.
//
// See also: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Max-Age
MaxAge int
}
CORSConfig defines the config for CORS middleware.
type GzipConfig ¶
type GzipConfig struct {
// Gzip compression level.
// Optional. Default value -1.
Level int
// Length threshold before gzip compression is applied.
// Optional. Default value 0.
//
// Most of the time you will not need to change the default. Compressing
// a short response might increase the transmitted data because of the
// gzip format overhead. Compressing the response will also consume CPU
// and time on the server and the client (for decompressing). Depending on
// your use case such a threshold might be useful.
//
// See also:
// https://webmasters.stackexchange.com/questions/31750/what-is-recommended-minimum-object-size-for-gzip-performance-benefits
MinLength int
}
GzipConfig defines the config for Gzip middleware.
type HandleFunc ¶
type HandleFunc func(e *core.RequestEvent) error
type RetryConfig ¶ added in v0.29.4
type RetryConfig struct {
MaxAttempts int `json:"max_attempts"`
Initial string `json:"initial_interval"` // e.g. "1s"
Max string `json:"max_interval"` // e.g. "1m"
Backoff float64 `json:"backoff_coefficient"`
}
RetryConfig controls retry behavior for a task.
type ServeConfig ¶
type ServeConfig struct {
// ShowStartBanner indicates whether to show or hide the server start console message.
ShowStartBanner bool
// HttpAddr is the TCP address to listen for the HTTP server (eg. "127.0.0.1:80").
HttpAddr string
// HttpsAddr is the TCP address to listen for the HTTPS server (eg. "127.0.0.1:443").
HttpsAddr string
// Optional domains list to use when issuing the TLS certificate.
//
// If not set, the host from the bound server address will be used.
//
// For convenience, for each "non-www" domain a "www" entry and
// redirect will be automatically added.
CertificateDomains []string
// AllowedOrigins is an optional list of CORS origins (default to "*").
AllowedOrigins []string
}
ServeConfig defines a configuration struct for apis.Serve().
type TaskClaimRequest ¶ added in v0.29.4
type TaskClaimRequest struct {
AgentID string `json:"agent_id"`
}
TaskClaimRequest is the body for POST /v1/tasks/{id}/claim.
type TaskCompleteRequest ¶ added in v0.29.4
TaskCompleteRequest is the body for POST /v1/tasks/{id}/complete.
type TaskCreateRequest ¶ added in v0.29.4
type TaskCreateRequest struct {
SpaceID string `json:"space_id"`
Title string `json:"title"`
Name string `json:"name"` // alias for title
Queue string `json:"queue"` // alias for space_id
Description string `json:"description"`
Priority int `json:"priority"` // 0=low, 1=normal, 2=high, 3=critical
AssignedTo string `json:"assigned_to"`
WorkflowID string `json:"workflow_id"`
ParentTaskID string `json:"parent_task_id"`
DependsOn []string `json:"depends_on"`
Labels []string `json:"labels"`
Input map[string]any `json:"input,omitempty"`
MaxRetries int `json:"max_retries"`
TimeoutSecs int `json:"timeout_secs"`
Timeout string `json:"timeout,omitempty"` // e.g. "1h", "30m" (parsed if timeout_secs=0)
Metadata map[string]string `json:"metadata,omitempty"`
Retry *RetryConfig `json:"retry,omitempty"` // alternative retry config
}
TaskCreateRequest is the body for POST /v1/tasks.
type TaskFailRequest ¶ added in v0.29.4
type TaskFailRequest struct {
Error string `json:"error"`
}
TaskFailRequest is the body for POST /v1/tasks/{id}/fail.
type TaskNextRequest ¶ added in v0.29.4
type TaskNextRequest struct {
SpaceID string `json:"space_id"`
Queue string `json:"queue"` // alias for space_id
AgentID string `json:"agent_id"`
}
TaskNextRequest is the body for POST /v1/tasks/next.
type TaskProgressRequest ¶ added in v0.29.4
type TaskProgressRequest struct {
Progress int `json:"progress"`
}
TaskProgressRequest is the body for POST /v1/tasks/{id}/progress.
type TaskSignalRequest ¶ added in v0.29.4
TaskSignalRequest is the body for POST /v1/tasks/{id}/signal.
type TaskUpdateRequest ¶ added in v0.29.4
type TaskUpdateRequest struct {
Title *string `json:"title"`
Description *string `json:"description"`
Priority *int `json:"priority"`
Labels []string `json:"labels"`
Metadata map[string]string `json:"metadata"`
}
TaskUpdateRequest is the body for PUT /v1/tasks/{id}.
type WorkflowCreateRequest ¶ added in v0.29.4
type WorkflowCreateRequest struct {
SpaceID string `json:"space_id"`
Queue string `json:"queue"` // alias for space_id
Name string `json:"name"`
Description string `json:"description"`
Tasks []TaskCreateRequest `json:"tasks"`
Steps []TaskCreateRequest `json:"steps"` // alias for tasks
Parallel bool `json:"parallel"` // fan-out mode
Metadata map[string]string `json:"metadata"`
}
WorkflowCreateRequest is the body for POST /v1/tasks/workflows.
Source Files
¶
- api_error_aliases.go
- backup.go
- backup_create.go
- backup_upload.go
- base.go
- batch.go
- collection.go
- collection_import.go
- cron.go
- file.go
- health.go
- installer.go
- logs.go
- middlewares.go
- middlewares_body_limit.go
- middlewares_cors.go
- middlewares_gzip.go
- middlewares_rate_limit.go
- private.go
- realtime.go
- realtime_grant.go
- record_auth.go
- record_auth_methods.go
- record_auth_refresh.go
- record_crud.go
- record_helpers.go
- rest.go
- serve.go
- settings.go
- sql.go
- tasks.go
- tasks_types.go