Skip to content

Commit 42a94c8

Browse files
committed
docs: scope statement and raw request docs
The README now says what is deliberately out (key management, health, contact, profile, legacy v0 routes) next to the coverage table, and documents the raw Get/Post/Put/Patch/Delete methods. Exports note the bare-filename guarantee; the sentinel table gains ErrMissingLongURL.
1 parent 9d06903 commit 42a94c8

2 files changed

Lines changed: 35 additions & 3 deletions

File tree

README.md

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,10 @@ public, err = client.PublicStats(ctx, "secret", spoo.PublicStatsQuery{
143143
Without explicit dates the API returns only the last 7 days; request up to
144144
`spoo.MaxRangeDays` (90) explicitly for more.
145145

146-
Exports stream and carry the server-suggested filename. The csv format
147-
arrives as a ZIP archive with one CSV per dimension:
146+
Exports stream and carry the server-suggested filename, reduced to a bare
147+
name so it is safe to pass to `os.Create` even against a self-hosted or
148+
untrusted deployment. The csv format arrives as a ZIP archive with one CSV
149+
per dimension:
148150

149151
```go
150152
file, err := client.Export(ctx, spoo.StatsQuery{}, "xlsx")
@@ -180,6 +182,7 @@ Common branches have predicates and sentinels:
180182
| --- | --- |
181183
| `spoo.IsNotFound(err)` | 404: no such resource, or not yours |
182184
| `spoo.IsRateLimited(err)` | 429: budget exhausted even after retries |
185+
| `errors.Is(err, spoo.ErrMissingLongURL)` | `Shorten` was called with an empty `LongURL`; nothing was sent |
183186
| `errors.Is(err, spoo.ErrSessionExpired)` | the refresh token no longer works; log in again |
184187
| `errors.Is(err, spoo.ErrLinkPasswordProtected)` | the link's stats need the link password |
185188
| `spoo.IsBlocked(err)` | 451: the link was taken down by the safety pipeline |
@@ -237,6 +240,16 @@ client := spoo.NewClient(
237240
process, implement the two-method `TokenSource` interface over your keyring,
238241
file, or database, and rotated tokens persist through it.
239242

243+
## Scope
244+
245+
The SDK covers the v1 data plane end to end: shortening, link management,
246+
claiming, bulk operations, stats, exports, public stats and previews, the
247+
emoji alias policy, identity (`Me`), and the Sign in with Spoo device flow.
248+
Deliberately out of scope: API key management, health checks, the contact
249+
endpoint, profile management, and all legacy v0 routes. Anything the API
250+
grows before the SDK does is reachable through the raw request methods
251+
below.
252+
240253
## API coverage
241254

242255
| Method | Endpoint |
@@ -255,6 +268,22 @@ file, or database, and rotated tokens persist through it.
255268
| `Me` | `GET /auth/me` |
256269
| `ExchangeDeviceCode`, `RefreshTokens`, `DeviceAuthURL` | `POST /auth/device/token`, `POST /auth/device/refresh` |
257270

271+
## Raw requests
272+
273+
For endpoints the SDK has no typed method for yet, `Get`, `Post`, `Put`,
274+
`Patch`, and `Delete` on the client take an API path directly and reuse
275+
the configured auth, token refresh, retries, client tag, and error
276+
mapping:
277+
278+
```go
279+
var out map[string]any
280+
err := client.Get(ctx, "/api/v1/new-endpoint", url.Values{"page": {"2"}}, &out)
281+
```
282+
283+
These are supported, not a workaround. Needing one means the SDK surface
284+
has a gap, and that gap is worth
285+
[an issue](https://github.com/spoo-me/spoo-go/issues).
286+
258287
## License
259288

260289
AGPL-3.0. See [LICENSE](LICENSE).

doc.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
// The package covers the v1 HTTP API: shortening, link management,
55
// claiming, bulk operations, stats, exports, public previews, the emoji
66
// alias policy, and the connected-apps device flow. It has no
7-
// dependencies outside the standard library.
7+
// dependencies outside the standard library. Endpoints without a typed
8+
// method yet are reachable through the raw [Client.Get], [Client.Post],
9+
// [Client.Put], [Client.Patch] and [Client.Delete] passthroughs, which
10+
// reuse the client's auth, retries and error mapping.
811
//
912
// # Quickstart
1013
//

0 commit comments

Comments
 (0)