+3
−0
route.go
0 → 100644
+196
−0
route_test.go
0 → 100644
+158
−0
Loading
Callers that want to label or group requests by endpoint have no way to recover the route from a concrete path. The templates exist in the client but withPath interpolates and discards them, so nothing survives to runtime. This adds the machinery only; converting the call sites is a separate commit so this one stays reviewable. route() registers a template and returns it unchanged, so it can be assigned to a package-level variable and still used as a format string. Registering as the package loads, rather than when a call is made, is what lets Routes() describe the whole client instead of only the calls that have happened. Routes() []Route every route, parameters replaced by :id MatchRoute(path) (Route, ok) the route a concrete path belongs to Matching prefers a literal segment over a parameter at each position, mirroring how the API routes, so "users/some-username/keys" resolves to /users/:id/keys rather than the username bein...