//! the public endpoint surface, declared once. //! //! every rendering of "what can you call here" — the ascii river, the html //! river, and /api/endpoints.json (which the static site templates from) — //! is generated from this table at comptime. the list drifted twice on //! 08-12 when it lived in four hand-maintained copies; it must not live //! anywhere else again. llms.txt is prose and stays hand-written, but the //! status contract asserts it mentions every path declared here. const std = @import("std"); pub const Group = enum { live, archive, ops }; pub const Endpoint = struct { method: []const u8, path: []const u8, desc: []const u8, group: Group, }; pub const table = [_]Endpoint{ .{ .method = "GET", .path = "/subscribe", .desc = "jetstream-compatible json firehose", .group = .live }, .{ .method = "GET", .path = "/xrpc/network.bsky.jetstream.subscribeEvents", .desc = "proposal-0015 lexicon frames: seq cursors, records, sync events", .group = .live }, .{ .method = "GET", .path = "/xrpc/network.bsky.jetstream.getZstdDictionary", .desc = "current v2 compression dictionary", .group = .live }, .{ .method = "GET", .path = "/xrpc/network.bsky.jetstream.listSegments", .desc = "browse the sealed archive", .group = .archive }, .{ .method = "GET", .path = "/xrpc/network.bsky.jetstream.getSegment", .desc = "download a sealed segment", .group = .archive }, .{ .method = "GET", .path = "/xrpc/network.bsky.jetstream.getBlock", .desc = "read one compressed block", .group = .archive }, .{ .method = "POST", .path = "/xrpc/network.bsky.jetstream.planSnapshot", .desc = "plan an archive range download", .group = .archive }, .{ .method = "GET", .path = "/status", .desc = "field report: live counters, config, provenance", .group = .ops }, .{ .method = "GET", .path = "/api/endpoints.json", .desc = "this endpoint list, as json", .group = .ops }, }; /// the display leaf: the NSID method name for xrpc paths, the whole path /// otherwise. the site bolds this part. fn leafIndex(comptime path: []const u8) usize { if (!std.mem.startsWith(u8, path, "/xrpc/")) return 0; return (std.mem.lastIndexOfScalar(u8, path, '.') orelse return 0) + 1; } fn pad(comptime s: []const u8, comptime width: usize) []const u8 { var out: []const u8 = s; while (out.len < width) out = out ++ " "; return out; } /// the ascii river's listing. xrpc NSIDs are self-describing, so only /// short non-xrpc paths carry an inline description (line-width budget). pub const text_block = blk: { var s: []const u8 = ""; var group: ?Group = null; for (table) |e| { if (group == null or group.? != e.group) { if (group != null) s = s ++ "\n"; s = s ++ " " ++ @tagName(e.group) ++ "\n"; group = e.group; } if (std.mem.startsWith(u8, e.path, "/xrpc/")) { s = s ++ " " ++ pad(e.method, 6) ++ e.path ++ "\n"; } else { s = s ++ " " ++ pad(e.method, 6) ++ pad(e.path, 21) ++ e.desc ++ "\n"; } } break :blk s; }; /// the html river's route rows (live + archive; ops render as nav links). pub const html_routes = blk: { var s: []const u8 = ""; for (table) |e| { if (e.group == .ops) continue; s = s ++ "