From 230b4e5db699c3c7e7b00127d2cfd9712fb64157 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Thu, 22 Aug 2024 13:31:39 -0400 Subject: [PATCH] rename: Constructeurs client.go pour inclure `*APIClient*` --- client.go | 8 ++++---- cmd.go | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/client.go b/client.go index 201be4d..94d073e 100644 --- a/client.go +++ b/client.go @@ -17,19 +17,19 @@ type API struct { Voki *voki.Voki } -// NewFromViper returns a pointer to a new API object, +// NewAPIClientFromViper returns a pointer to a new API object, // provided the configuration options are managed by // https://git.agecem.com/agecem/agecem-org/config -func NewFromViper(client *http.Client) (api *API, err error) { +func NewAPIClientFromViper(client *http.Client) (api *API, err error) { var config Config if err = viper.Unmarshal(&config); err != nil { return nil, err } - return New(client, config.Server.Api.Host, config.Server.Api.Key, config.Server.Api.Port, config.Server.Api.Protocol) + return NewAPIClient(client, config.Server.Api.Host, config.Server.Api.Key, config.Server.Api.Port, config.Server.Api.Protocol) } -func New(client *http.Client, host, key string, port int, protocol string) (*API, error) { +func NewAPIClient(client *http.Client, host, key string, port int, protocol string) (*API, error) { return &API{Voki: voki.New(client, host, key, port, protocol)}, nil } diff --git a/cmd.go b/cmd.go index f627dbf..0d49d7a 100644 --- a/cmd.go +++ b/cmd.go @@ -17,7 +17,6 @@ import ( "codeberg.org/vlbeaudoin/pave/v2" "codeberg.org/vlbeaudoin/serpents" - "git.agecem.com/agecem/agecem-org/api" "git.agecem.com/agecem/agecem-org/media" "git.agecem.com/agecem/agecem-org/public" "git.agecem.com/agecem/agecem-org/templates" @@ -351,7 +350,7 @@ func RunServer() { client := http.DefaultClient defer client.CloseIdleConnections() - apiClient, err := api.NewFromViper(client) + apiClient, err := NewAPIClientFromViper(client) if err != nil { log.Fatal(err) }