refactor: moved http.Client to model.RequestContext

Signed-off-by: SoXX <soxx@fenpa.ws>
This commit is contained in:
SoXX 2023-10-23 13:29:39 +02:00
parent 5e8c3509ea
commit af69de28cf

View File

@ -22,14 +22,11 @@ func main() {
// Log: Getting a single pool. // Log: Getting a single pool.
log.Println("Getting single pool: ") log.Println("Getting single pool: ")
// Initialize an http.Client.
client := http.Client{}
// Specify the pool ID for retrieval. // Specify the pool ID for retrieval.
poolID := "36957" // Replace with the desired pool's ID. poolID := "36957" // Replace with the desired pool's ID.
// Call the GetPool function to retrieve the specified pool. // Call the GetPool function to retrieve the specified pool.
pool, err := endpoints.GetPool(client, requestContext, poolID) pool, err := endpoints.GetPool(requestContext, poolID)
if err != nil { if err != nil {
log.Println(err) log.Println(err)
@ -48,7 +45,7 @@ func main() {
} }
// Call the GetPools function to retrieve a list of pools based on the query parameters. // Call the GetPools function to retrieve a list of pools based on the query parameters.
pools, err := endpoints.GetPools(client, requestContext, query) pools, err := endpoints.GetPools(requestContext, query)
if err != nil { if err != nil {
log.Println(err) log.Println(err)