github.com/esnet/gdg@v0.6.1-0.20240412190737-6b6eba9c14d8/internal/api/health.go (about) 1 package api 2 3 import ( 4 "context" 5 "net/http" 6 ) 7 8 //Health Check used to get various server info 9 10 type HealthResponse struct { 11 Commit string `json:"commit,omitempty"` 12 Database string `json:"database,omitempty"` 13 Version string `json:"version,omitempty"` 14 } 15 16 func (extended *ExtendedApi) Health() (*HealthResponse, error) { 17 health := &HealthResponse{} 18 err := extended.getRequestBuilder(). 19 Path("api/health"). 20 ToJSON(health). 21 Method(http.MethodGet).Fetch(context.Background()) 22 return health, err 23 24 }