Commit graph

20 commits

Author SHA1 Message Date
fd3cae1866 feat: SpaceAPI v15 support
Delete types/v14.go, replace with v15.go.

Rename internal types to not include message version.
I don't currently see the need to support multiple message
versions that have incompatible layouts.
v15 is backwards compatible with v14, so the config example now
specifies both.

Rename the "response" field in the config file to "static" as
dynamic/static makes more sense from the user's perspective.
(Internally it's still SpaceapidConfig.{Dynamic,Response}
to align with type names and usage.)
2026-07-25 22:51:26 +02:00
34d05ffa49 feat(handlers): Handle DELETE for environment sensors
It now works as advertised in the README! *ahem*...
2026-07-25 22:51:26 +02:00
e714cca477 refactor(handlers): Use fmt.Errorf instead of errors.New(fmt.Sprintf()) 2026-07-25 21:16:40 +02:00
74fbef4ae8 refactor(handlers): Use http.Header.Set instead of direct map access 2026-07-25 21:16:06 +02:00
68d0ec05db feat: Add support for PUT/DELETE state.message
Fix #33
2024-08-03 19:50:19 +02:00
74a8db7d2b refactor: Add Go 1.22 HTTP method matching 2024-08-03 17:55:28 +02:00
8c1adae040
Rename module 2024-05-26 20:52:15 +02:00
2fb2e5f151
We don't need to write anything on successful requests actually, 200 is the default 2024-01-16 01:48:48 +01:00
fa6e6bd142
Set WWW-Authenticate header directly and change realm to spaceapid for consistency 2024-01-16 01:37:54 +01:00
bc299d4c70
Set charset=utf-8 in Content-Type header 2024-01-16 01:24:19 +01:00
cf9678d712
Actually end the connection when request checks fail 2024-01-15 23:24:58 +01:00
7ac8e91cc2
Improve logging in handlers/util.go 2024-01-15 22:32:52 +01:00
cc9cb8888c
Improve logging in handlers/state.go 2024-01-15 22:32:51 +01:00
efbd55aac4
Improve logging in handlers/sensors.go 2024-01-15 22:32:50 +01:00
1d30c16e46
More readable return statement 2024-01-15 22:24:57 +01:00
2495ce5808
Remove superfluous WriteHeader calls 2024-01-15 22:20:53 +01:00
70b2e8069b
Only pass State struct pointer to StateOpen, not entire response 2024-01-14 02:02:58 +01:00
38710484f9
Generate HTTP endpoints for environment sensors
- Move update request sanity checks to new method in handlers/util.go
- Change EnvironmentSensor.Value type because ParseFloat returns float64
2024-01-14 01:10:38 +01:00
b2f62c7bb0
First implementation of new config format
- Functionally equivalent to old version at present
- Temperature and Humidity sensors not handled yet
- Moved HTTP handlers around
2024-01-13 23:27:24 +01:00
4b41acfa7b
Major Refactoring
- Move components to separate packages
- Fix HTTP header for 401 response
- Add documentation
2023-11-09 22:30:03 +01:00