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/builder/db_export_list.go
SoXX 9cee99ecb5 docs: added more & unified documentation format
Signed-off-by: SoXX <soxx@fenpa.ws>
2023-11-15 14:37:44 +01:00

40 lines
1.3 KiB
Go

package builder
import (
"git.dragse.it/anthrove/e621-sdk-go/pkg/e621/endpoints"
"git.dragse.it/anthrove/e621-sdk-go/pkg/e621/model"
)
// DBExportListBuilder defines an interface for building and executing requests to retrieve a list of exported databases.
type DBExportListBuilder interface {
// Execute sends the request and returns a list of exported databases or an error if the request fails.
Execute() ([]string, error)
}
// NewGetDBExportListBuilder creates a new instance of DBExportListBuilder.
//
// Parameters:
// - requestContext: The context for the API request, including the host, user agent, username, and API key.
//
// Returns:
// - DBExportListBuilder: An instance of the DBExportListBuilder interface.
func NewGetDBExportListBuilder(requestContext model.RequestContext) DBExportListBuilder {
return &getDBExportList{
requestContext: requestContext,
}
}
// getDBExportList is an implementation of the DBExportListBuilder interface.
type getDBExportList struct {
requestContext model.RequestContext
}
// Execute sends the API request to retrieve a list of exported databases.
//
// Returns:
// - []string: A list of exported databases.
// - error: An error, if any, encountered during the API request or response handling.
func (g *getDBExportList) Execute() ([]string, error) {
return endpoints.GetDBExportList(g.requestContext)
}