tenseleyflow/shithub / d8d5c07

Browse files

changelog: note S50 §0 cross-cutting REST API contract

Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
d8d5c07e4796f4f1b4245f1ab257a42e1e257f8c
Parents
c1b73b6
Tree
005086d

2 changed files

StatusFile+-
M CHANGELOG.md 22 1
M internal/web/handlers/api/cross_test.go 1 1
CHANGELOG.mdmodified
@@ -10,7 +10,28 @@ between minor releases.
10
 
10
 
11
 ## [Unreleased]
11
 ## [Unreleased]
12
 
12
 
13
-(Empty — first post-launch entries land here.)
13
+### Added
14
+
15
+- **REST API contract (S50 §0).** `GET /api/v1/meta` returns the
16
+  server's version stamp and a list of feature capability strings
17
+  for client-side feature detection. Every `/api/v1/*` response
18
+  now carries `X-RateLimit-Limit`, `X-RateLimit-Remaining`,
19
+  `X-RateLimit-Reset`, and (when PAT-authenticated) `X-OAuth-Scopes`.
20
+  The 403 scope-reject response also carries
21
+  `X-Accepted-OAuth-Scopes`. Operators tune the API rate-limit
22
+  budgets via `ratelimit.api.authed_per_hour` /
23
+  `ratelimit.api.anon_per_hour` (defaults: 5000 / 60).
24
+- **Pagination helper** `internal/web/handlers/api/apipage` —
25
+  emits canonical RFC 8288 Link headers (`first`/`prev`/`next`/`last`)
26
+  with absolute URLs rooted at the configured public base URL.
27
+
28
+### Changed
29
+
30
+- **JSON error envelope on `/api/v1/*`.** `401` and `403`
31
+  responses now emit `{"error": "..."}` with
32
+  `Content-Type: application/json` (previously `text/plain`).
33
+  Existing `4xx`/`5xx` responses from the handler bodies are
34
+  unchanged.
14
 
35
 
15
 ## [0.1.0] — TBD (operator fills in cutover date)
36
 ## [0.1.0] — TBD (operator fills in cutover date)
16
 
37
 
internal/web/handlers/api/cross_test.gomodified
@@ -19,8 +19,8 @@ import (
19
 	"github.com/tenseleyFlow/shithub/internal/ratelimit"
19
 	"github.com/tenseleyFlow/shithub/internal/ratelimit"
20
 	"github.com/tenseleyFlow/shithub/internal/testing/dbtest"
20
 	"github.com/tenseleyFlow/shithub/internal/testing/dbtest"
21
 	usersdb "github.com/tenseleyFlow/shithub/internal/users/sqlc"
21
 	usersdb "github.com/tenseleyFlow/shithub/internal/users/sqlc"
22
-	apih "github.com/tenseleyFlow/shithub/internal/web/handlers/api"
23
 	"github.com/tenseleyFlow/shithub/internal/version"
22
 	"github.com/tenseleyFlow/shithub/internal/version"
23
+	apih "github.com/tenseleyFlow/shithub/internal/web/handlers/api"
24
 	"github.com/tenseleyFlow/shithub/internal/web/handlers/api/apilimit"
24
 	"github.com/tenseleyFlow/shithub/internal/web/handlers/api/apilimit"
25
 )
25
 )
26
 
26