35 lines
1.3 KiB
Go
35 lines
1.3 KiB
Go
package endpoints
|
|
|
|
import (
|
|
"fmt"
|
|
"git.dragse.it/anthrove/e621-sdk-go/pkg/e621/model"
|
|
)
|
|
|
|
// GetPool retrieves a pool 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 pool to retrieve.
|
|
//
|
|
// Returns:
|
|
// - model.Pool: The retrieved pool.
|
|
// - error: An error, if any, encountered during the API request or response handling.
|
|
func GetPool(requestContext model.RequestContext, ID string) (model.Pool, error) {
|
|
endpoint := fmt.Sprintf("pools/%s.json", ID)
|
|
return getRequest[model.Pool](requestContext, endpoint, nil)
|
|
}
|
|
|
|
// GetPools retrieves a list of pools 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.Pool: A slice of pools.
|
|
// - error: An error, if any, encountered during the API request or response handling.
|
|
func GetPools(requestContext model.RequestContext, query map[string]string) ([]model.Pool, error) {
|
|
endpoint := "pools.json"
|
|
return getRequest[[]model.Pool](requestContext, endpoint, query)
|
|
}
|