package main import ( "git.dragse.it/anthrove/e621-to-graph/pkg/e621/endpoints" "git.dragse.it/anthrove/e621-to-graph/pkg/e621/model" "log" "net/http" ) func main() { // Define the request context with essential information. requestContext := model.RequestContext{ Host: "https://e621.net", UserAgent: "Go-e621-SDK (@username)", Username: "", // Replace with your username APIKey: "", // Replace with your API key } // Log: Getting a single post. log.Println("Getting single post: ") // Initialize an HTTP client. client := http.Client{} // Specify the post ID for retrieval. postID := "4353480" // Replace with the desired post's ID. // Call the GetPost function to retrieve the specified post. post, err := endpoints.GetPost(client, requestContext, postID) if err != nil { log.Println(err) } else { // Log the URL of the retrieved post. log.Println(post.File.URL) } log.Println("----------") // Log: Getting a list of posts. log.Println("Getting a list of posts: ") // Define query parameters for retrieving a list of posts. query := map[string]string{ "limit": "5", } // Call the GetPosts function to retrieve a list of posts based on the query parameters. posts, err := endpoints.GetPosts(client, requestContext, query) if err != nil { log.Println(err) } else { // Log the number of posts retrieved. log.Println(len(posts)) } log.Println("----------") }