From 84e344e34d00c0666372b5317579ee662b1317f8 Mon Sep 17 00:00:00 2001 From: SoXX Date: Mon, 23 Oct 2023 08:56:14 +0200 Subject: [PATCH] doc: used correct http.Client Signed-off-by: SoXX --- example/lowlevel/favorite.go | 2 +- example/lowlevel/note.go | 2 +- example/lowlevel/pool.go | 2 +- example/lowlevel/post.go | 2 +- example/lowlevel/tag.go | 2 +- example/lowlevel/user.go | 2 +- pkg/e621/endpoints/favorite.go | 4 ++-- pkg/e621/endpoints/note.go | 8 ++++---- pkg/e621/endpoints/pool.go | 8 ++++---- pkg/e621/endpoints/post.go | 8 ++++---- pkg/e621/endpoints/tag.go | 9 +++++---- pkg/e621/endpoints/user.go | 8 ++++---- 12 files changed, 29 insertions(+), 28 deletions(-) diff --git a/example/lowlevel/favorite.go b/example/lowlevel/favorite.go index 2c5b760..8be62c0 100644 --- a/example/lowlevel/favorite.go +++ b/example/lowlevel/favorite.go @@ -19,7 +19,7 @@ func main() { // Log: Getting favorites from the API. log.Println("Getting favorites API user: ") - // Initialize an HTTP client. + // Initialize an http.Client. client := http.Client{} // Define query parameters for retrieving favorites. diff --git a/example/lowlevel/note.go b/example/lowlevel/note.go index 5c4668c..b4ea6c3 100644 --- a/example/lowlevel/note.go +++ b/example/lowlevel/note.go @@ -19,7 +19,7 @@ func main() { // Log: Getting a single note. log.Println("Getting single note: ") - // Initialize an HTTP client. + // Initialize an http.Client. client := http.Client{} // Specify the note ID for retrieval. diff --git a/example/lowlevel/pool.go b/example/lowlevel/pool.go index 514f50c..d70b1f3 100644 --- a/example/lowlevel/pool.go +++ b/example/lowlevel/pool.go @@ -19,7 +19,7 @@ func main() { // Log: Getting a single pool. log.Println("Getting single pool: ") - // Initialize an HTTP client. + // Initialize an http.Client. client := http.Client{} // Specify the pool ID for retrieval. diff --git a/example/lowlevel/post.go b/example/lowlevel/post.go index 1f50956..1d59d23 100644 --- a/example/lowlevel/post.go +++ b/example/lowlevel/post.go @@ -19,7 +19,7 @@ func main() { // Log: Getting a single post. log.Println("Getting single post: ") - // Initialize an HTTP client. + // Initialize an http.Client. client := http.Client{} // Specify the post ID for retrieval. diff --git a/example/lowlevel/tag.go b/example/lowlevel/tag.go index 6385817..318efd2 100644 --- a/example/lowlevel/tag.go +++ b/example/lowlevel/tag.go @@ -19,7 +19,7 @@ func main() { // Log: Getting a single tag. log.Println("Getting a single tag: ") - // Initialize an HTTP client. + // Initialize an http.Client. client := http.Client{} // Specify the tag ID for retrieval. diff --git a/example/lowlevel/user.go b/example/lowlevel/user.go index d1cb09a..d121e7d 100644 --- a/example/lowlevel/user.go +++ b/example/lowlevel/user.go @@ -19,7 +19,7 @@ func main() { // Log: Getting a single user. log.Println("Getting a single user: ") - // Initialize an HTTP client. + // Initialize an http.Client. client := http.Client{} // Specify the username for retrieval. diff --git a/pkg/e621/endpoints/favorite.go b/pkg/e621/endpoints/favorite.go index c577740..b7cb8a4 100644 --- a/pkg/e621/endpoints/favorite.go +++ b/pkg/e621/endpoints/favorite.go @@ -14,7 +14,7 @@ import ( // The user_id parameter is required to get the favorites of a user. // // Parameters: -// - client: An HTTP client used to make the API request. +// - 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. // @@ -39,7 +39,7 @@ func GetFavorites(client http.Client, requestContext model.RequestContext, query r.Header.Add("Accept", "application/json") r.SetBasicAuth(requestContext.Username, requestContext.APIKey) - // Send the request using the provided HTTP client. + // Send the request using the provided http.Client. resp, err := client.Do(r) if err != nil { log.Print(err) diff --git a/pkg/e621/endpoints/note.go b/pkg/e621/endpoints/note.go index f3eb2a0..83a6f2d 100644 --- a/pkg/e621/endpoints/note.go +++ b/pkg/e621/endpoints/note.go @@ -12,7 +12,7 @@ import ( // GetNote retrieves a single note by its ID from the e621 API. // // Parameters: -// - client: An HTTP client used to make the API request. +// - 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 note to retrieve. // @@ -32,7 +32,7 @@ func GetNote(client http.Client, requestContext model.RequestContext, ID string) r.Header.Add("Accept", "application/json") r.SetBasicAuth(requestContext.Username, requestContext.APIKey) - // Send the request using the provided HTTP client. + // Send the request using the provided http.Client. resp, err := client.Do(r) if err != nil { // Log the error and return an empty Note struct and the error. @@ -64,7 +64,7 @@ func GetNote(client http.Client, requestContext model.RequestContext, ID string) // GetNotes retrieves a list of notes from the e621 API based on query parameters. // // Parameters: -// - client: An HTTP client used to make the API request. +// - 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. // @@ -89,7 +89,7 @@ func GetNotes(client http.Client, requestContext model.RequestContext, query map r.Header.Add("Accept", "application/json") r.SetBasicAuth(requestContext.Username, requestContext.APIKey) - // Send the request using the provided HTTP client. + // Send the request using the provided http.Client. resp, err := client.Do(r) if err != nil { log.Print(err) diff --git a/pkg/e621/endpoints/pool.go b/pkg/e621/endpoints/pool.go index fedc99c..fb44060 100644 --- a/pkg/e621/endpoints/pool.go +++ b/pkg/e621/endpoints/pool.go @@ -12,7 +12,7 @@ import ( // GetPool retrieves a pool by its ID from the e621 API. // // Parameters: -// - client: An HTTP client used to make the API request. +// - 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 pool to retrieve. // @@ -32,7 +32,7 @@ func GetPool(client http.Client, requestContext model.RequestContext, ID string) r.Header.Add("Accept", "application/json") r.SetBasicAuth(requestContext.Username, requestContext.APIKey) - // Send the request using the provided HTTP client. + // Send the request using the provided http.Client. resp, err := client.Do(r) if err != nil { // Log the error and return an empty Pool struct and the error. @@ -64,7 +64,7 @@ func GetPool(client http.Client, requestContext model.RequestContext, ID string) // GetPools retrieves a list of pools from the e621 API based on query parameters. // // Parameters: -// - client: An HTTP client used to make the API request. +// - 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. // @@ -89,7 +89,7 @@ func GetPools(client http.Client, requestContext model.RequestContext, query map r.Header.Add("Accept", "application/json") r.SetBasicAuth(requestContext.Username, requestContext.APIKey) - // Send the request using the provided HTTP client. + // Send the request using the provided http.Client. resp, err := client.Do(r) if err != nil { log.Print(err) diff --git a/pkg/e621/endpoints/post.go b/pkg/e621/endpoints/post.go index 65d809c..d26dcfb 100644 --- a/pkg/e621/endpoints/post.go +++ b/pkg/e621/endpoints/post.go @@ -12,7 +12,7 @@ import ( // GetPost retrieves a single post by its ID from the e621 API. // // Parameters: -// - client: An HTTP client used to make the API request. +// - 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 post to retrieve. // @@ -32,7 +32,7 @@ func GetPost(client http.Client, requestContext model.RequestContext, ID string) r.Header.Add("Accept", "application/json") r.SetBasicAuth(requestContext.Username, requestContext.APIKey) - // Send the request using the provided HTTP client. + // Send the request using the provided http.Client. resp, err := client.Do(r) if err != nil { // Log the error and return an empty Post struct and the error. @@ -64,7 +64,7 @@ func GetPost(client http.Client, requestContext model.RequestContext, ID string) // GetPosts retrieves a list of posts from the e621 API based on query parameters. // // Parameters: -// - client: An HTTP client used to make the API request. +// - 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. // @@ -89,7 +89,7 @@ func GetPosts(client http.Client, requestContext model.RequestContext, query map r.Header.Add("Accept", "application/json") r.SetBasicAuth(requestContext.Username, requestContext.APIKey) - // Send the request using the provided HTTP client. + // Send the request using the provided http.Client. resp, err := client.Do(r) if err != nil { log.Print(err) diff --git a/pkg/e621/endpoints/tag.go b/pkg/e621/endpoints/tag.go index b563f65..58ae37f 100644 --- a/pkg/e621/endpoints/tag.go +++ b/pkg/e621/endpoints/tag.go @@ -12,7 +12,7 @@ import ( // GetTag retrieves a tag by its ID from the e621 API. // // Parameters: -// - client: An HTTP client used to make the API request. +// - 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. // @@ -32,7 +32,7 @@ func GetTag(client http.Client, requestContext model.RequestContext, ID string) r.Header.Add("Accept", "application.json") r.SetBasicAuth(requestContext.Username, requestContext.APIKey) - // Send the request using the provided HTTP client. + // Send the request using the provided http.Client. resp, err := client.Do(r) if err != nil { // Log the error and return an empty Tag struct and the error. @@ -59,12 +59,13 @@ func GetTag(client http.Client, requestContext model.RequestContext, ID string) // Return the tag information and no error (nil). return tag, nil + } // 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. +// - 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. // @@ -99,7 +100,7 @@ func GetTags(client http.Client, requestContext model.RequestContext, query map[ r.Header.Add("Accept", "application/json") r.SetBasicAuth(requestContext.Username, requestContext.APIKey) - // Send the request using the provided HTTP client. + // Send the request using the provided http.Client. resp, err := client.Do(r) if err != nil { log.Print(err) diff --git a/pkg/e621/endpoints/user.go b/pkg/e621/endpoints/user.go index 1f52cde..f2a25c7 100644 --- a/pkg/e621/endpoints/user.go +++ b/pkg/e621/endpoints/user.go @@ -12,7 +12,7 @@ import ( // GetUser retrieves user information from e621.net based on the provided username. // // Parameters: -// - client: An HTTP client used to make the API request. +// - 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. // - username: The username of the user to retrieve. // @@ -32,7 +32,7 @@ func GetUser(client http.Client, requestContext model.RequestContext, username s r.Header.Add("Accept", "application/json") r.SetBasicAuth(requestContext.Username, requestContext.APIKey) - // Send the request using the provided HTTP client. + // Send the request using the provided http.Client. resp, err := client.Do(r) if err != nil { // Log the error and return an empty User struct and the error. @@ -64,7 +64,7 @@ func GetUser(client http.Client, requestContext model.RequestContext, username s // GetUsers retrieves a list of users from e621.net based on query parameters. // // Parameters: -// - client: An HTTP client used to make the API request. +// - 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. // @@ -89,7 +89,7 @@ func GetUsers(client http.Client, requestContext model.RequestContext, query map r.Header.Add("Accept", "application/json") r.SetBasicAuth(requestContext.Username, requestContext.APIKey) - // Send the request using the provided HTTP client. + // Send the request using the provided http.Client. resp, err := client.Do(r) if err != nil { log.Print(err)