Files
雷电芽衣 27b720ca69 chore(go): audit root package
Share one request, decode, and error path across the client, public
endpoints, and export download; align types with the Backend contract
and split types_api.go.

Claude-Session: https://claude.ai/code/session_01Agoc9bRVE9KL7mmWtey9Vq
2026-09-03 01:06:42 -04:00

30 lines
702 B
Go

package elydora
import "net/http"
// Health checks the public health endpoint.
func Health(baseURL string) (*HealthResponse, error) {
var result HealthResponse
if err := publicRequest(http.MethodGet, normalizeBaseURL(baseURL)+"/v1/health", nil, &result); err != nil {
return nil, err
}
return &result, nil
}
// DeepHealth checks backend dependencies; 503 reports a degraded API.
func DeepHealth(baseURL string) (*DeepHealthResponse, error) {
var result DeepHealthResponse
err := publicRequest(
http.MethodGet,
normalizeBaseURL(baseURL)+"/v1/health/deep",
nil,
&result,
http.StatusOK,
http.StatusServiceUnavailable,
)
if err != nil {
return nil, err
}
return &result, nil
}