From e063db1d590f93e8d79ed9253f67e9af57417954 Mon Sep 17 00:00:00 2001 From: SoXX Date: Mon, 23 Oct 2023 10:29:02 +0200 Subject: [PATCH] refactor: moved http.Client to model.RequestContext Signed-off-by: SoXX --- pkg/e621/endpoints/tag.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pkg/e621/endpoints/tag.go b/pkg/e621/endpoints/tag.go index 58ae37f..ed384b4 100644 --- a/pkg/e621/endpoints/tag.go +++ b/pkg/e621/endpoints/tag.go @@ -12,14 +12,13 @@ import ( // GetTag retrieves a tag by its ID from the e621 API. // // Parameters: -// - client: An http.Client used to make the API request. // - requestContext: The context for the API request, including the host, user agent, username, and API key. // - ID: The ID of the tag to retrieve. // // Returns: // - model.Tag: The retrieved tag. // - error: An error, if any, encountered during the API request or response handling. -func GetTag(client http.Client, requestContext model.RequestContext, ID string) (model.Tag, error) { +func GetTag(requestContext model.RequestContext, ID string) (model.Tag, error) { // Create a new HTTP GET request to fetch tag information. r, err := http.NewRequest("GET", fmt.Sprintf("%s/tags/%s.json", requestContext.Host, ID), nil) if err != nil { @@ -33,7 +32,7 @@ func GetTag(client http.Client, requestContext model.RequestContext, ID string) r.SetBasicAuth(requestContext.Username, requestContext.APIKey) // Send the request using the provided http.Client. - resp, err := client.Do(r) + resp, err := requestContext.Client.Do(r) if err != nil { // Log the error and return an empty Tag struct and the error. log.Println(err) @@ -65,7 +64,6 @@ func GetTag(client http.Client, requestContext model.RequestContext, ID string) // GetTags retrieves a list of tags from the e621 API based on query parameters. // // Parameters: -// - client: An http.Client used to make the API request. // - requestContext: The context for the API request, including the host, user agent, username, and API key. // - query: A map containing additional query parameters for the API request. //