From 3da2cb7f5b9634479620ee39d4d250c83bdfc741 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Thu, 8 Jun 2023 21:40:14 -0400 Subject: [PATCH] =?UTF-8?q?Retirer=20r=C3=A9impl=C3=A9mentation=20de=20bot?= =?UTF-8?q?tin=20health?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit N'était plus utilisé, et le type était redondant avec le response struct de agecem/bottin/v5/responses#GetHealth --- data/apiclient.go | 35 ----------------------------------- 1 file changed, 35 deletions(-) diff --git a/data/apiclient.go b/data/apiclient.go index 78ea400..6132a12 100644 --- a/data/apiclient.go +++ b/data/apiclient.go @@ -1,11 +1,8 @@ package data import ( - "encoding/json" - "errors" "fmt" "io" - "io/ioutil" "net/http" ) @@ -61,35 +58,3 @@ func (a *ApiClient) Call(method, route string, requestBody io.Reader, useKey boo return response, nil } - -// BottinHealthResponse is the response type for GetBottinHealth -type BottinHealthResponse struct { - Message string `json:"message"` -} - -// GetHealth allows checking for API server health -func (a *ApiClient) GetBottinHealth() (string, error) { - var healthResponse BottinHealthResponse - - response, err := a.Call(http.MethodGet, "/v4/health", nil, true) - if err != nil { - return healthResponse.Message, err - } - - defer response.Body.Close() - - body, err := ioutil.ReadAll(response.Body) - if err != nil { - return healthResponse.Message, err - } - - if err := json.Unmarshal(body, &healthResponse); err != nil { - return healthResponse.Message, err - } - - if healthResponse.Message == "" { - return healthResponse.Message, errors.New("Could not confirm that API server is up, no response message") - } - - return healthResponse.Message, nil -} -- 2.45.2