This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
e621-sdk-go/pkg/e621/endpoints/note.go

35 lines
1.3 KiB
Go
Raw Normal View History

package endpoints
import (
"fmt"
"git.dragse.it/anthrove/e621-sdk-go/pkg/e621/model"
)
// GetNote retrieves a single note by its ID from the e621 API.
//
// Parameters:
// - requestContext: The context for the API request, including the host, user agent, username, and API key.
// - ID: The ID of the note to retrieve.
//
// Returns:
// - model.Note: The retrieved note.
// - error: An error, if any, encountered during the API request or response handling.
func GetNote(requestContext model.RequestContext, ID string) (model.Note, error) {
endpoint := fmt.Sprintf("notes/%s.json", ID)
return getRequest[model.Note](requestContext, endpoint, nil)
}
// GetNotes retrieves a list of notes from the e621 API based on query parameters.
//
// Parameters:
// - 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.
//
// Returns:
// - []model.Note: A slice of notes.
// - error: An error, if any, encountered during the API request or response handling.
func GetNotes(requestContext model.RequestContext, query map[string]string) ([]model.Note, error) {
endpoint := "notes.json"
return getRequest[[]model.Note](requestContext, endpoint, query)
}