Documentation
¶
Overview ¶
Package httpapi serves the tix REST API and event stream.
Index ¶
- Constants
- func ClientIPFrom(ctx context.Context) netip.Addr
- func InviteURL(r *http.Request, token string) string
- func IsPublicPath(path string) bool
- func IsSCIMPath(path string) bool
- func Origin(r *http.Request) string
- func PublicOrigin(r *http.Request) string
- func RequestIDFrom(ctx context.Context) string
- func SchemeFrom(ctx context.Context) string
- func WithPublicURL(ctx context.Context, base string) context.Context
- func WriteDAVChallenge(w http.ResponseWriter)
- func WriteError(w http.ResponseWriter, err error)
- func WriteJSON(w http.ResponseWriter, status int, v any)
- type ActorQuery
- type AddMemberRequest
- type AuditQuery
- type BundleImportQuery
- type Check
- type ClientMessage
- type CommentRequest
- type Config
- type CreateTaskRequest
- type DBProbe
- type DeleteTaskQuery
- type DeletionPlanQuery
- type DeliveryListQuery
- type DependencyRequest
- type EventLog
- type EventPollQuery
- type EventStream
- type GroupQuery
- type HealthBody
- type Hub
- func (h *Hub) Broadcast(e core.Event)
- func (h *Hub) Len() int
- func (h *Hub) Pump(ctx context.Context, src <-chan core.Event)
- func (h *Hub) Register(c *wsConn)
- func (h *Hub) SetRegistry(r *connections.Registry)
- func (h *Hub) SetTenantHooks(onFirst, onLast func(tenantID string))
- func (h *Hub) Unregister(c *wsConn)
- type Idempotency
- type ImportQuery
- type InboxQuery
- type LoginRequest
- type PageQuery
- type ProjectDeleteQuery
- type ProjectListQuery
- type ProjectQuery
- type ReadyBody
- type ReleaseBody
- type ReleaseChanges
- type ReleaseEntry
- type ReleaseMethod
- type ReleaseRequest
- type ReleaseSource
- type RenewRequest
- type Revalidate
- type Router
- type ServerMessage
- type SharedHosts
- type StatsQuery
- type SweepRequest
- type SweepResult
- type TOTPCodeRequest
- type TagRequest
- type TaskAuditQuery
- type TaskListQuery
- type TemplateListQuery
- type TenantResolver
- type TreeQuery
- type UserListQuery
- type WakeResult
Constants ¶
const ( DefaultMaxBodyBytes = 1 << 20 DefaultRequestTimeout = 30 * time.Second )
Defaults for the limits every request is subject to.
const ( MsgSubscribe = "subscribe" MsgUnsubscribe = "unsubscribe" MsgPing = "ping" )
Client message types accepted on the event stream.
const ( MsgSubscribed = "subscribed" MsgEvent = "event" MsgPong = "pong" MsgError = "error" )
Server message types sent on the event stream.
const FieldFilterParam = "custom_fields"
FieldFilterParam carries custom field filters as one typed JSON object, which is how a machine client keeps a numeric field numeric.
const FieldFilterPrefix = "field."
FieldFilterPrefix starts a parameter field.KEY that keeps tasks whose custom field KEY holds the value, as in field.severity=high. A value that parses as JSON is matched as that scalar, so 3 is a number and "3" a string.
const HeaderRequestID = "X-Request-Id"
HeaderRequestID carries the identifier correlating a request with its logs.
const MsgAuthRefusalsHeldBack = "auth refusals held back"
MsgAuthRefusalsHeldBack is the message of the record that reports refusals held back when no later refusal record carried their count.
const MsgAuthRefused = "auth refused"
MsgAuthRefused is the message of the record a refused credential logs.
const NegatedPrefix = "not_"
NegatedPrefix marks the excluding form of a list parameter, so "?not_tag=ops" is the wire spelling of the filter expression's "-tag:ops".
const RouteStats = wire.RouteStats
RouteStats is the statistics route, defined in wire beside every other one so the capability registry can name it without importing this package.
const StatusClientClosed = 499
StatusClientClosed is the status recorded for a request whose client went away before it was answered, after nginx's 499. No client ever reads it.
const TaskPagePrefix = "/tasks/"
TaskPagePrefix starts the browser address of a task's page, which every feed event links to.
const TextTermParam = "text"
TextTermParam carries one explicit title or body predicate per value, each spelled the way the filter expression spells it: "title~api", "-body~legacy". One repeated parameter rather than a parameter per field and mode keeps the negated weak match expressible without six more names.
Variables ¶
This section is empty.
Functions ¶
func ClientIPFrom ¶
ClientIPFrom returns the address the request is attributed to. It is invalid when the peer address could not be parsed.
func InviteURL ¶ added in v0.45.0
InviteURL is the absolute address of an invite link under this request's Origin.
func IsPublicPath ¶ added in v0.39.0
IsPublicPath reports whether a route runs without a credential.
func IsSCIMPath ¶ added in v0.63.0
IsSCIMPath reports whether a request is for the SCIM endpoints.
func Origin ¶ added in v0.51.0
Origin is the address the links built from this request go under: the configured public address on a host that serves several tenants, and the request's own scheme and host on a tenant's own domain or when no public address is configured. The task screen's Share menu, the hand-off dialog, calendar feeds, invite links and the Connect screen all build from it.
func PublicOrigin ¶ added in v0.51.0
PublicOrigin is the configured public address when it applies to this request, or "". It does not apply on a host bound to one tenant: that host is the tenant's own address, and a link to it is a link to the tenant.
func RequestIDFrom ¶
RequestIDFrom returns the identifier assigned to the request, if any.
func SchemeFrom ¶
SchemeFrom returns the scheme the client reached the deployment over, which is the proxy's scheme when a trusted proxy reported one.
func WithPublicURL ¶ added in v0.51.0
WithPublicURL returns a context carrying the configured public address, as the router's middleware sets it on every request. Empty sets nothing.
func WriteDAVChallenge ¶ added in v0.69.0
func WriteDAVChallenge(w http.ResponseWriter)
WriteDAVChallenge answers 401 with the Basic challenge and a body that names nothing about the server's tenants or people.
func WriteError ¶
func WriteError(w http.ResponseWriter, err error)
WriteError renders err as the standard envelope with its mapped status. An internal failure is reported generically, so no SQL text, stack trace or credential can reach a client.
Types ¶
type ActorQuery ¶ added in v0.39.0
type ActorQuery struct {
// ActorID is the ID of the actor whose credentials to list; absent means
// the caller.
ActorID string `query:"actor_id"`
}
ActorQuery names whose credentials to list.
type AddMemberRequest ¶
type AddMemberRequest struct {
// ActorID is the actor to grant the role to.
ActorID string `json:"actor_id"`
// Role is the role to grant, which decides the member's scopes.
Role core.Role `json:"role"`
}
AddMemberRequest grants an actor a role in the resolved tenant.
type AuditQuery ¶ added in v0.39.0
type AuditQuery struct {
PageQuery
// SubjectType keeps entries about one kind of record, such as task,
// project or workflow.
SubjectType string `query:"subject_type"`
// SubjectID keeps entries about one record, named by its ID.
SubjectID string `query:"subject_id"`
// ActorID keeps entries recorded by an actor, named by ID; repeat it for
// several.
ActorID []string `query:"actor_id"`
// Action keeps entries of an action such as task.create or
// project.update; repeat it for several.
Action []string `query:"action"`
// Text is a case-insensitive substring searched for in the action, the
// kind of record, the source and the recorded before and after values.
Text string `query:"text"`
// Source keeps entries that arrived from a surface: cli, api, web, tui or
// system; repeat it for several.
Source []string `query:"source"`
// Via keeps entries that arrived through an access channel: web, api,
// cli-local, cli-remote, ssh, mcp, sync, import, scim, caldav, system or
// unknown; repeat it for several.
Via []string `query:"via"`
// Token keeps entries made with an API token, named by the token's name;
// repeat it for several.
Token []string `query:"token"`
// Since keeps entries recorded at or after an RFC 3339 instant.
Since time.Time `query:"since"`
// Until keeps entries recorded at or before an RFC 3339 instant.
Until time.Time `query:"until"`
}
AuditQuery is the filter an audit listing reads.
type BundleImportQuery ¶ added in v0.39.0
type BundleImportQuery struct {
// OnCollision is what happens to a component whose key is taken: skip
// keeps the existing one, rename imports under a new key, replace
// overwrites. Required when a key collides; there is no default.
OnCollision string `query:"on_collision"`
// Preview is true to report the plan and write nothing.
Preview bool `query:"preview"`
// ProjectRef is the key or ID of the project that project-scoped
// components, such as field definitions, land in.
ProjectRef string `query:"project_ref"`
}
BundleImportQuery is how a bundle import is asked for.
type Check ¶
type Check struct {
// Name is the probe, "database" or "migrations".
Name string `json:"name"`
// OK is true when the probe passed.
OK bool `json:"ok"`
// Error says why the probe failed, set only when it did.
Error string `json:"error,omitempty"`
}
Check is one readiness probe and its outcome.
type ClientMessage ¶
type ClientMessage struct {
Type string `json:"type"`
ID string `json:"id,omitempty"`
Filter *core.EventFilter `json:"filter,omitempty"`
SinceSeq *int64 `json:"since_seq,omitempty"`
}
ClientMessage is one message sent by a client on the event stream.
type CommentRequest ¶
type CommentRequest struct {
// Body is the comment text, Markdown.
Body string `json:"body"`
}
CommentRequest carries a comment body.
type Config ¶
type Config struct {
Service core.Service
Authenticator auth.Authenticator
Resolver TenantResolver
Logger *slog.Logger
// Clock paces the refusal log's once a minute per client. Nil is the
// real clock.
Clock clock.Clock
// DefaultTenantID pins requests whose Host maps to no tenant. When it is
// empty an unknown host is answered with not found.
DefaultTenantID string
MaxBodyBytes int64
RequestTimeout time.Duration
// MaxImportBytes caps a project task import, which carries a file, in
// place of MaxBodyBytes. ImportRoutes are further mux patterns that take
// it, the browser's import upload among them.
MaxImportBytes int64
ImportRoutes []string
// MaxArtifactBytes is the largest artifact blob the service takes. The
// artifact route and ArtifactRoutes accept a body sized to carry one, so
// --max-body-bytes never refuses an upload the limit would allow.
MaxArtifactBytes int64
ArtifactRoutes []string
// SecureCookies forces the session and CSRF cookies Secure regardless of
// the scheme a request arrived on. It is the floor, not the ceiling: a
// request whose effective scheme is https gets a Secure cookie anyway.
SecureCookies bool
// CookieSecurity overrides how Secure is decided. The default derives it
// from the effective scheme of each request. Its vocabulary is owned by
// internal/config, which is where server.cookie_security is parsed and
// validated; this package names those constants rather than restating them.
CookieSecurity string
// PublicURL is server.public_url, the address people reach the browser
// interface at. Links built from a request on a host that serves several
// tenants use it in place of the request's own host; see Origin.
PublicURL string
// TrustedProxies lists the proxy addresses, as IPs or CIDR blocks, whose
// X-Forwarded-Proto and X-Forwarded-For are believed. Leaving it empty
// believes neither header from anybody, because any client can send them.
TrustedProxies []string
Probe DBProbe
ExpectedSchema int
// Idempotency keeps the answers of writes sent with an Idempotency-Key.
// Left nil, the router uses its service when the service provides it.
Idempotency Idempotency
// EventHandler serves the WebSocket event route when it is supplied.
EventHandler http.Handler
// SCIM serves SCIM 2.0 provisioning under core.SCIMPath when it is
// supplied. It is its own protocol, described by its own discovery
// endpoints rather than by the OpenAPI document.
SCIM http.Handler
// CalDAV serves tasks over CalDAV under core.DAVPath, and /.well-known/caldav
// redirects there, when it is supplied. Like SCIM it is its own protocol,
// described by its own discovery rather than by the OpenAPI document.
// Left nil, both answer not found.
CalDAV http.Handler
// DAVAuthenticator is the only authenticator consulted under core.DAVPath:
// HTTP Basic carrying an app password. Cookies and bearer tokens are never
// read there.
DAVAuthenticator auth.Authenticator
// Releases answers what the release check knows. The browser interface
// shares the same one, so the route and the release screen agree. Left
// nil, the route reports the running version alone.
Releases ReleaseSource
// WebHandler serves the browser interface at the root when it is supplied.
// It is registered last and only for paths the API does not claim, so an
// API route can never be shadowed by a page.
WebHandler http.Handler
}
Config assembles a Router.
type CreateTaskRequest ¶ added in v0.29.0
type CreateTaskRequest struct {
core.CreateTaskInput
// Parse reads Title as a quick-add line such as "Fix login !high #auth
// @raj due:fri", with relative dates counted in UTC.
Parse bool `json:"parse,omitempty"`
}
CreateTaskRequest is the body of a create. Parse reads Title as a quick-add line, relative dates counted in UTC since the API knows no reader's zone.
type DBProbe ¶
type DBProbe interface {
Health(ctx context.Context) error
SchemaVersion(ctx context.Context) (int, error)
}
DBProbe reports database reachability and the applied schema version.
type DeleteTaskQuery ¶ added in v0.39.0
type DeleteTaskQuery struct {
// Hard is true to delete the task for good instead of moving it to the
// trash.
Hard bool `query:"hard"`
// Cascade is true to delete the task's whole subtree with it. Without it,
// a task with subtasks is refused.
Cascade bool `query:"cascade"`
}
DeleteTaskQuery is how a task deletion is asked for.
type DeletionPlanQuery ¶ added in v0.39.0
type DeletionPlanQuery struct {
// MoveTasksTo is the key or ID of the project the tasks would move to.
MoveTasksTo string `query:"move_tasks_to"`
// DeleteTasks is true to plan deleting the tasks with the project.
DeleteTasks bool `query:"delete_tasks"`
}
DeletionPlanQuery is the deletion a plan is drawn up for.
type DeliveryListQuery ¶ added in v0.39.0
type DeliveryListQuery struct {
PageQuery
// EndpointID keeps the deliveries of one webhook, named by ID.
EndpointID string `query:"endpoint_id"`
// Status keeps deliveries in a state: pending, delivered or failed;
// repeat it for several.
Status []string `query:"status"`
}
DeliveryListQuery is the filter a webhook delivery listing reads.
type DependencyRequest ¶
type DependencyRequest struct {
// DependsOn is the reference of the task to wait for, such as "OPS-12".
DependsOn string `json:"depends_on"`
}
DependencyRequest names the task a task waits for.
type EventLog ¶
type EventLog interface {
ReadSince(ctx context.Context, tenantID string, sinceSeq int64, limit int) ([]core.Event, error)
OldestSeq(ctx context.Context, tenantID string) (int64, error)
}
EventLog replays durable events so a resuming subscriber loses nothing.
type EventPollQuery ¶ added in v0.51.0
type EventPollQuery struct {
// SinceSeq is the exclusive cursor: events after this sequence number are
// returned. Absent or 0 starts at the newest event.
SinceSeq int64 `query:"since_seq"`
// Types keeps events of these types, comma separated or repeated; a
// trailing * matches a prefix, as in task.*.
Types []string `query:"types"`
// ProjectIDs keeps events of these projects, comma separated or repeated.
ProjectIDs []string `query:"project_ids"`
// Limit is how many events to return at most: default 200, at most 1000.
Limit int `query:"limit"`
// Wait is how long to hold the request when no event is available yet, a
// duration such as 25s or a number of seconds: default 0, at most 25s.
Wait string `query:"wait"`
}
EventPollQuery is what a poll of the event log reads.
type EventStream ¶
type EventStream struct {
// contains filtered or unexported fields
}
EventStream upgrades an authenticated request and serves the WebSocket event protocol.
func NewEventStream ¶
func NewEventStream(hub *Hub, log EventLog) *EventStream
NewEventStream builds a stream fanning out over hub and replaying from log.
func (*EventStream) ServeHTTP ¶
func (s *EventStream) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP authenticates at upgrade time and then runs the connection.
type GroupQuery ¶ added in v0.39.0
type GroupQuery struct {
// Group is the group to reset, spelled as in the view's groups; absent
// resets every group of the view.
Group string `query:"group"`
}
GroupQuery names one group of a view.
type HealthBody ¶
type HealthBody struct {
// Status is always "ok".
Status string `json:"status"`
// Version is the tix version the process runs.
Version string `json:"version"`
}
HealthBody reports that the process is alive.
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
Hub fans committed events out to the connections entitled to receive them.
func NewHub ¶
func NewHub() *Hub
NewHub builds an empty hub feeding the process-wide connection registry.
func (*Hub) Broadcast ¶
Broadcast delivers an event to every entitled subscription without ever blocking on one connection.
func (*Hub) Register ¶
func (h *Hub) Register(c *wsConn)
Register adds a connection to the fan-out set.
func (*Hub) SetRegistry ¶
func (h *Hub) SetRegistry(r *connections.Registry)
SetRegistry sends this hub's connections to another registry. A process has one registry, so this exists for a test that wants its own and for a caller assembling a server explicitly.
func (*Hub) SetTenantHooks ¶
SetTenantHooks registers callbacks fired when a tenant gains its first connection and loses its last. Events are read per tenant, so a caller uses these to run exactly one reader per tenant that anyone is listening to. A hook must not register or unregister a connection itself.
func (*Hub) Unregister ¶
func (h *Hub) Unregister(c *wsConn)
Unregister removes a connection and discards its subscriptions.
type Idempotency ¶ added in v0.51.0
type Idempotency interface {
BeginIdempotent(ctx context.Context, in service.IdempotentRequest) (*service.IdempotentStart, error)
FinishIdempotent(ctx context.Context, c *service.IdempotencyClaim, resp service.IdempotentResponse) error
}
Idempotency reserves and settles the keys clients send to retry a write. The router finds it on its service when Config leaves it unset; without it the Idempotency-Key header is ignored.
type ImportQuery ¶ added in v0.39.0
type ImportQuery struct {
// Mode is required: merge adds and updates, while replace also removes the
// tasks and field definitions of an imported project that the snapshot
// does not carry.
Mode string `query:"mode"`
// DryRun is true to report what the import would do and write nothing.
DryRun bool `query:"dry_run"`
}
ImportQuery is how a snapshot import is asked for.
type InboxQuery ¶ added in v0.39.0
type InboxQuery struct {
PageQuery
// Unread is true to keep unread items only.
Unread bool `query:"unread"`
// Kind keeps items of one kind: mention, assigned, status or comment; repeat it for several.
Kind []string `query:"kind"`
}
InboxQuery is the filter an inbox listing reads.
type LoginRequest ¶
type LoginRequest struct {
// Email identifies the user, in the first step.
Email string `json:"email,omitempty"`
// Password is the user's password, in the first step.
Password string `json:"password,omitempty"`
// NewPassword replaces the password, sent with the email and password
// again after a password_change challenge.
NewPassword string `json:"new_password,omitempty"`
// Surface is the sign-in path the session is for, which decides whether a
// second factor is required.
Surface core.Surface `json:"surface,omitempty"`
// Ticket is the challenge ticket from the first step, in the second step.
Ticket string `json:"ticket,omitempty"`
// Code is the six-digit TOTP code or a recovery code, in the second step.
Code string `json:"code,omitempty"`
// Remember asks for a "keep me signed in" session, sent with the step
// that completes the sign-in. The session then lasts the tenant's
// remember_ttl and its cookie persists until then.
Remember bool `json:"remember,omitempty"`
}
LoginRequest carries one step of an interactive sign-in. The first step sends the address, the password and the surface; the second sends the ticket the challenge answered with and the code.
type PageQuery ¶ added in v0.39.0
type PageQuery struct {
// Limit is the most items one page holds: default 50, at most 500.
Limit int `query:"limit"`
// Cursor is the next_cursor of the previous page, to read the page after
// it. Leave it out for the first page.
Cursor string `query:"cursor"`
// Sort names the field the listing is ordered by. Each listing has its own
// default and refuses a field it cannot sort by.
Sort string `query:"sort"`
// Direction is asc or desc, default asc.
Direction string `query:"direction" enum:"asc,desc"`
}
PageQuery is the keyset page every paginated listing reads.
type ProjectDeleteQuery ¶ added in v0.39.0
type ProjectDeleteQuery struct {
// Archive is true to archive the project instead of deleting it, which
// keeps its tasks and answers 204.
Archive bool `query:"archive"`
// MoveTasksTo is the key or ID of the project the tasks move to. A project
// holding tasks needs this or delete_tasks, not both.
MoveTasksTo string `query:"move_tasks_to"`
// DeleteTasks is true to delete the project's tasks permanently with it.
DeleteTasks bool `query:"delete_tasks"`
}
ProjectDeleteQuery is how a project deletion is asked for.
type ProjectListQuery ¶ added in v0.39.0
type ProjectListQuery struct {
PageQuery
// Key keeps a project, named by key; repeat it for several.
Key []string `query:"key"`
// IncludeArchived is true to list archived projects too.
IncludeArchived bool `query:"include_archived"`
}
ProjectListQuery is the filter a project listing reads.
type ProjectQuery ¶ added in v0.39.0
type ProjectQuery struct {
// Project is the key or ID of the project whose policy to show; absent
// shows the tenant's.
Project string `query:"project"`
}
ProjectQuery names one project, or none for the tenant default.
type ReadyBody ¶
type ReadyBody struct {
// Ready is true when every check passed.
Ready bool `json:"ready"`
// Checks are the individual probes and their outcomes.
Checks []Check `json:"checks"`
}
ReadyBody reports whether the server can serve traffic.
type ReleaseBody ¶ added in v0.59.0
type ReleaseBody struct {
// Running is this binary's version, without a leading v.
Running string `json:"running"`
// Latest is the newest published release, empty until a check succeeds.
Latest string `json:"latest"`
// Status is newer, current, unknown when the versions cannot be
// compared, failed when the feed could not be read, or pending when
// nothing has been asked yet.
Status string `json:"status"`
// Newer reports whether Latest is ahead of Running.
Newer bool `json:"newer"`
// Checked reports whether a check has finished, whatever it answered.
Checked bool `json:"checked"`
// Failed reports whether the most recent check got no usable answer.
Failed bool `json:"failed"`
// Notes are the newest release's notes as Markdown with every link
// taken out and the heading naming the release dropped. Empty unless
// Newer.
Notes string `json:"notes"`
// Methods are the commands that upgrade each install method to Latest.
// Empty unless Newer.
Methods []ReleaseMethod `json:"methods"`
// Changes is the bundled changelog around the running version.
Changes ReleaseChanges `json:"changes"`
}
ReleaseBody is the running version, the newest published release and what the bundled changelog says: the browser's release screen as data.
type ReleaseChanges ¶ added in v0.59.0
type ReleaseChanges struct {
// Running is the running version's own entry, left out unless this build is
// a tagged release the changelog has an entry for.
Running *ReleaseEntry `json:"running,omitempty"`
// Earlier are up to ten entries before Running, or the eleven newest
// when Running is left out.
Earlier []ReleaseEntry `json:"earlier"`
// Untagged reports that the running version is not a plain
// major.minor.patch, so the build is not a tagged release.
Untagged bool `json:"untagged"`
}
ReleaseChanges is the "What's new" selection from the bundled changelog.
type ReleaseEntry ¶ added in v0.59.0
type ReleaseEntry struct {
// Version is the release, without a leading v.
Version string `json:"version"`
// Date is the release date, YYYY-MM-DD, or empty.
Date string `json:"date"`
// Notes is the entry as Markdown with every link taken out.
Notes string `json:"notes"`
}
ReleaseEntry is one changelog entry.
type ReleaseMethod ¶ added in v0.59.0
type ReleaseMethod struct {
// ID is binary, container or go.
ID string `json:"id"`
// Name names the install method.
Name string `json:"name"`
// Help says when the method applies.
Help string `json:"help"`
// Command upgrades that install to Latest.
Command string `json:"command"`
}
ReleaseMethod is one way tix is installed and the command that upgrades it.
type ReleaseRequest ¶
type ReleaseRequest struct {
// Token is the lease token the claim returned.
Token string `json:"token"`
core.ReleaseInput
}
ReleaseRequest gives up a lease held under a token.
type ReleaseSource ¶ added in v0.59.0
ReleaseSource is what the release check knows; *release.Watch is one.
type RenewRequest ¶
type RenewRequest struct {
// Token is the lease token the claim returned.
Token string `json:"token"`
// TTL is the new lease length from now, such as "30m" or "4h"; omitted
// takes the default a fresh claim would get. The lease cap still applies.
TTL core.Duration `json:"ttl,omitempty"`
}
RenewRequest extends a lease held under a token.
type Revalidate ¶
Revalidate re-resolves the actor a long-lived connection was opened for. A connection that outlives one request has to ask again, because logout, a revocation, an expiry or a role change all happen after the upgrade.
func RevalidateFrom ¶
func RevalidateFrom(ctx context.Context) (Revalidate, bool)
RevalidateFrom returns the revalidator for the credential the request presented, if the request carried one.
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router serves the tix REST API.
func (*Router) Patterns ¶ added in v0.39.0
Patterns returns every pattern registered on the router, in the order it was registered.
func (*Router) ReportHeldBackRefusals ¶ added in v0.68.2
ReportHeldBackRefusals reports the refusal log's held-back counts once a minute, and every count still held when ctx ends, so a client that stops does not take its count with it.
type ServerMessage ¶
type ServerMessage struct {
Type string `json:"type"`
ID string `json:"id,omitempty"`
SinceSeq int64 `json:"since_seq,omitempty"`
Event *core.Event `json:"event,omitempty"`
Error *wire.ErrorBody `json:"error,omitempty"`
}
ServerMessage is one message sent by the server on the event stream.
type SharedHosts ¶ added in v0.47.0
type SharedHosts interface {
// whether the domain is marked shared; an unclaimed host is not found.
ResolveHost(ctx context.Context, hostname string) (*core.Tenant, bool, error)
TenantForKey(ctx context.Context, key string) (*core.Tenant, error)
TenantAddress(ctx context.Context, tenantID string) (string, error)
CredentialTenant(ctx context.Context, tokenHash string) (string, error)
}
SharedHosts is what serving several tenants on one host needs beyond mapping a hostname to its tenant. service.Local provides it.
type StatsQuery ¶ added in v0.39.0
type StatsQuery struct {
// Project is the key or ID of one project to report on; absent covers
// the whole tenant.
Project string `query:"project"`
// Since is the RFC 3339 instant the window starts at. It overrides window.
Since time.Time `query:"since"`
// Window is how far back the report reaches, a duration such as 7d or
// 168h: default 14 days, at most 3650.
Window string `query:"window"`
// Top is how many actors the report ranks: default 5, at most 100.
Top int `query:"top"`
// Oldest is how many of the oldest open tasks the report lists: default
// 5, at most 100.
Oldest int `query:"oldest"`
}
StatsQuery is the window a statistics report covers.
type SweepRequest ¶
type SweepRequest struct {
// Limit caps how many records this pass handles; 0 or omitted means 50.
Limit int `json:"limit,omitempty"`
}
SweepRequest bounds one lease sweep.
type SweepResult ¶
type SweepResult struct {
// Swept is how many expired leases were cleared.
Swept int `json:"swept"`
}
SweepResult reports how many leases a sweep materialized.
type TOTPCodeRequest ¶ added in v0.17.0
type TOTPCodeRequest struct {
// Code is the current code from the authenticator, or a recovery code
// where one is accepted.
Code string `json:"code"`
}
TOTPCodeRequest carries the code proving possession of an authenticator.
type TagRequest ¶
type TagRequest struct {
// Name is the tag to attach; it is created on first use.
Name string `json:"name"`
}
TagRequest carries a tag name.
type TaskAuditQuery ¶ added in v0.39.0
type TaskAuditQuery struct {
PageQuery
// ActorID keeps entries recorded by an actor, named by ID; repeat it for
// several.
ActorID []string `query:"actor_id"`
// Action keeps entries of an action such as task.create or
// project.update; repeat it for several.
Action []string `query:"action"`
// Text is a case-insensitive substring searched for in the action, the
// kind of record, the source and the recorded before and after values.
Text string `query:"text"`
// Source keeps entries that arrived from a surface: cli, api, web, tui or
// system; repeat it for several.
Source []string `query:"source"`
// Via keeps entries that arrived through an access channel: web, api,
// cli-local, cli-remote, ssh, mcp, sync, import, scim, caldav, system or
// unknown; repeat it for several.
Via []string `query:"via"`
// Token keeps entries made with an API token, named by the token's name;
// repeat it for several.
Token []string `query:"token"`
// Since keeps entries recorded at or after an RFC 3339 instant.
Since time.Time `query:"since"`
// Until keeps entries recorded at or before an RFC 3339 instant.
Until time.Time `query:"until"`
}
TaskAuditQuery is the filter a task's own audit trail reads.
type TaskListQuery ¶ added in v0.39.0
type TaskListQuery struct {
PageQuery
// Page reads the listing from page N, counting from one, of limit tasks
// each, instead of from a cursor; the two cannot be combined. A number
// past the end answers the last page, and the response says which page it
// served. The cursor stays the way to walk a listing; this is for landing
// on a page a person asked for.
Page int `query:"page"`
// Tally is true to have the response count the whole selection, every
// page of it, in tally: tasks per project and status, tasks waiting on a
// dependency and tasks under a live claim. It costs one grouped count.
Tally bool `query:"tally"`
// Project keeps tasks in a project, named by key, not case sensitive;
// repeat it for several. An unknown key is an error.
Project []string `query:"project"`
// ProjectID keeps tasks in a project, named by ID; repeat it for several.
ProjectID []string `query:"project_id"`
// Status keeps tasks in a workflow state, named by key, not case
// sensitive; repeat it for several. A state no workflow declares is an
// error.
Status []string `query:"status"`
// Tag keeps tasks carrying a tag; repeat it for several, and a task must
// carry every one.
Tag []string `query:"tag"`
// Assignee keeps tasks assigned to an actor, named by ID, handle or me;
// repeat it for several.
Assignee []string `query:"assignee"`
// Creator keeps tasks created by an actor, named by ID, handle or me;
// repeat it for several.
Creator []string `query:"creator"`
// ClaimedBy keeps tasks claimed by an actor, named by ID, handle or me;
// repeat it for several.
ClaimedBy []string `query:"claimed_by"`
// ParentID keeps the direct subtasks of one task, named by reference such
// as INFRA-42 or by ID. It cannot be combined with root_only.
ParentID string `query:"parent_id"`
// Q is a free text search over title and body: a substring match on
// SQLite, a full text match on PostgreSQL.
Q string `query:"q"`
// RootOnly is true to keep only tasks without a parent.
RootOnly bool `query:"root_only"`
// IncludeDeleted is true to list tasks in the trash alongside live ones.
IncludeDeleted bool `query:"include_deleted"`
// Claimed is true for tasks under a live claim, false for the rest, and
// absent for either.
Claimed string `query:"claimed"`
// Starred is true for tasks the caller starred, false for the rest, and
// absent for either.
Starred string `query:"starred"`
// Blocked is true for tasks waiting on an unfinished dependency, false for
// the rest, and absent for either.
Blocked string `query:"blocked"`
// Recurring is true for tasks with a repeat rule, false for the rest, and
// absent for either.
Recurring string `query:"recurring"`
// Checklist is true for tasks whose body holds a checklist, false for the
// rest, and absent for either.
Checklist string `query:"checklist"`
// ChecklistOpen is true for tasks with an unticked checklist item, false
// for the rest, and absent for either.
ChecklistOpen string `query:"checklist_open"`
// Trashed is true for the trash alone, false for live tasks alone, and
// absent to follow include_deleted.
Trashed string `query:"trashed"`
// Snoozed is true for snoozed tasks alone, false for the rest, or any for
// both. Absent leaves snoozed tasks out.
Snoozed string `query:"snoozed"`
// Priority keeps tasks of a priority from 1, the highest, to 5, the
// lowest; repeat it for several.
Priority []int `query:"priority"`
// NotProject leaves out tasks in a project, named by key; repeat it for
// several.
NotProject []string `query:"not_project"`
// NotStatus leaves out tasks in a workflow state; repeat it for several.
NotStatus []string `query:"not_status"`
// NotTag leaves out tasks carrying a tag; repeat it for several.
NotTag []string `query:"not_tag"`
// NotAssignee leaves out tasks assigned to an actor, named by ID, handle
// or me; repeat it for several.
NotAssignee []string `query:"not_assignee"`
// NotCreator leaves out tasks created by an actor, named by ID, handle or
// me; repeat it for several.
NotCreator []string `query:"not_creator"`
// NotClaimedBy leaves out tasks claimed by an actor, named by ID, handle
// or me; repeat it for several.
NotClaimedBy []string `query:"not_claimed_by"`
// NotPriority leaves out tasks of a priority from 1 to 5; repeat it for
// several.
NotPriority []int `query:"not_priority"`
// Text is a title or body predicate: title, body or any, then : for the
// whole field or ~ for a substring, then the value, as in title~api. A
// leading - negates it. Case is ignored; repeat it, and every term must
// hold.
Text []string `query:"text"`
// DueBefore keeps tasks due before an RFC 3339 instant, such as
// 2026-05-01T00:00:00Z.
DueBefore time.Time `query:"due_before"`
// DueAfter keeps tasks due after an RFC 3339 instant, such as
// 2026-05-01T00:00:00Z.
DueAfter time.Time `query:"due_after"`
// CustomFields is a JSON object of custom field values a task must hold,
// such as {"severity":"high","points":3}. Each value is a string, number
// or boolean. A parameter field.KEY matches one field and wins over this.
CustomFields string `query:"custom_fields"`
// Format is csv to answer the page as CSV instead of JSON.
Format string `query:"format" enum:"csv"`
}
TaskListQuery is the task filter a task listing reads.
func (TaskListQuery) QueryPrefixes ¶ added in v0.39.0
func (TaskListQuery) QueryPrefixes() []string
QueryPrefixes names the parameter families a task listing reads by prefix.
type TemplateListQuery ¶ added in v0.39.0
type TemplateListQuery struct {
PageQuery
// Project is the key or ID of a project: the listing keeps its templates
// and the tenant-wide ones.
Project string `query:"project"`
}
TemplateListQuery is the filter a template listing reads.
type TenantResolver ¶
type TenantResolver interface {
ResolveDomain(ctx context.Context, hostname string) (*core.Tenant, error)
}
TenantResolver maps a hostname to the tenant that owns it.
type TreeQuery ¶ added in v0.39.0
type TreeQuery struct {
// Depth is how many levels below the task to include; 0 or absent is
// every level.
Depth int `query:"depth"`
}
TreeQuery bounds a task tree.
type UserListQuery ¶ added in v0.51.0
type UserListQuery struct {
PageQuery
// IncludeRemoved is true to list people removed from the tenant too,
// each marked removed.
IncludeRemoved bool `query:"include_removed"`
// WithoutTOTP is true to list only people who hold no confirmed second
// factor.
WithoutTOTP bool `query:"without_totp"`
}
UserListQuery is the filter a user listing reads.
type WakeResult ¶ added in v0.29.0
type WakeResult struct {
// Woken is how many expired snoozes were cleared.
Woken int `json:"woken"`
}
WakeResult reports how many snoozes a wake pass cleared.
Source Files
¶
- handlers_auth.go
- handlers_bundle.go
- handlers_calendar.go
- handlers_claim.go
- handlers_connection.go
- handlers_dav.go
- handlers_events.go
- handlers_filter.go
- handlers_globaladmin.go
- handlers_health.go
- handlers_history.go
- handlers_inbox.go
- handlers_invite.go
- handlers_project.go
- handlers_release.go
- handlers_scim.go
- handlers_sso.go
- handlers_stats.go
- handlers_status.go
- handlers_task.go
- handlers_template.go
- handlers_tenant.go
- handlers_timeprefs.go
- handlers_transfer.go
- handlers_view.go
- handlers_webhook.go
- hub.go
- idempotency.go
- middleware.go
- origin.go
- query.go
- refusallog.go
- router.go
- wire.go
- ws.go