/// The request-scoped API passed to a route action.pubconstAction = struct {
auth: *auth_api.Request = &auth_api.disabled,
db: Database,
cache: Cache = .{},
jobs: Jobs,
notifications: Notifications,
storage: Storage,
logger: *constLogger,
/// The framework-generated request identifier.
request_id: Request.Id,
headers: Headers,
cookies: Cookies,
flash: Flash,
locals: @FieldType(Request, "locals"),
session: *@FieldType(Request, "session"),
io: std.Io,
arena: std.mem.Allocator,
method: @FieldType(Request, "method"),
method_string: []constu8,
url: @FieldType(Request, "url"),
/// The parsed inbound Content-Type field, or `null` when absent.
content_type: ?MediaType,
/// Response formats acceptable to the request in preference order.
formats: []constRequest.Format,
pubconstFormat = Request.Format;
pubconstAuthorization = Request.Authorization;
pubconstQueryParameters = Request.QueryParameters;
pubconstInvalidPayloadDetail = Request.InvalidPayloadDetail;
pubconstInvalidPayloadDetails = Request.InvalidPayloadDetails;
/// Guarded immediate response operations.pubconstRaw = struct {
/// Commits headers on the first call and writes one chunk immediately.pubfnchunk(self: *Raw, data: []constu8) !void;
/// Transfers response ownership and all later cleanup to the application.pubfndisown(self: *Raw) !void;
/// Commits and disowns an event stream, then runs its owner on a detached thread.pubfnstart_event_stream(
self: *Raw,
context: anytype,
comptime handler: fn (@TypeOf(context), std.Io.net.Stream) void,
) !void;
/// Commits and disowns an event stream, returning its application-owned stream.pubfnstart_event_stream_sync(self: *Raw) !std.Io.net.Stream;
/// Commits response headers without completing or transferring the response.pubfnwrite_header(self: *Raw) !void;
/// Commits and completes the response, or terminates an active chunked response.pubfnwrite(self: *Raw) !void;
};
/// Copies a plain-text response into request memory and returns its outcome.pubfntext(self: *Action, body_bytes: []constu8, options: Response.Options) !Response;
/// Copies a HTML response into request memory and returns its outcome.pubfnhtml(self: *Action, body_bytes: []constu8, options: Response.Options) !Response;
/// Copies a XML response into request memory and returns its outcome.pubfnxml(self: *Action, body_bytes: []constu8, options: Response.Options) !Response;
/// Copies a Markdown response into request memory and returns its outcome.pubfnmarkdown(self: *Action, body_bytes: []constu8, options: Response.Options) !Response;
/// Copies a iCalendar response into request memory and returns its outcome.pubfnics(self: *Action, body_bytes: []constu8, options: Response.Options) !Response;
/// Copies a CSV response into request memory and returns its outcome.pubfncsv(self: *Action, body_bytes: []constu8, options: Response.Options) !Response;
/// Copies a SVG response into request memory and returns its outcome.pubfnsvg(self: *Action, body_bytes: []constu8, options: Response.Options) !Response;
/// Copies a byte response and its metadata into request memory.pubfnbytes(self: *Action, body_bytes: []constu8, options: Response.BytesOptions) !Response;
/// Prepares an empty response using request-owned metadata.pubfnempty(self: *Action, options: Response.Options) !Response;
/// Copies the redirect location into request memory.pubfnredirect(self: *Action, status: std.http.Status, location: []constu8) !Response;
/// Copies an authentication challenge into request memory.pubfnchallenge(
self: *Action,
comptime scheme: Response.ChallengeScheme,
options: switch (scheme) {
.basic => Response.BasicChallengeOptions,
.bearer => Response.BearerChallengeOptions,
},
) !Response;
/// Returns the raw request body when one is present.pubfnbody(self: *constAction) ?[]constu8;
/// Parses the unique Authorization request field.pubfnauthorization(self: *Action) !Authorization;
/// Returns a decoded matched-route parameter.pubfnparam(self: *constAction, key: []constu8) []constu8;
/// Parses and returns the request query fields.pubfnquery(self: *Action) !QueryParameters;
/// Requires a decoded request payload matching `T`.pubfnexpect_payload(self: *Action, comptimeT: type) !T;
/// Returns details from the most recent typed payload failure.pubfninvalid_payload_details(self: *constAction) ?InvalidPayloadDetails;
/// Returns the decoded request body payload.pubfnpayload(self: *Action) !?std.json.ObjectMap;
/// Renders a view and returns its completed response.pubfnrender(
self: *Action,
comptime template_name: []constu8,
params: anytype,
options: Response.Options,
) !Response;
/// Serializes a value as JSON and returns its completed response.pubfnjson(self: *Action, value: anytype, options: Response.Options) !Response;
/// Applies request preconditions to the current selected representation./// Returns a completed 304 or 412 response, or null to continue.pubfnapply_preconditions(
self: *Action,
current: ?Validators,
) !?Response;
/// Returns the buffered response writer, or `null` after a terminal precondition.pubfnwriter(self: *Action, options: Response.WriterOptions) !?*std.Io.Writer;
/// Returns guarded immediate response operations.pubfnraw(self: *Action) *Raw;
};