package builder import ( "git.dragse.it/anthrove/e621-sdk-go/pkg/e621/endpoints" "git.dragse.it/anthrove/e621-sdk-go/pkg/e621/model" ) // DBExportFileBuilder defines an interface for building and executing requests to retrieve a specific exported database file. type DBExportFileBuilder interface { // SetFile sets the name of the file to be retrieved. SetFile(fileName string) DBExportFileBuilder // Execute sends the request and returns the content of the exported database file or an error if the request fails. Execute() ([]byte, error) } // NewGetDBExportFileBuilder creates a new instance of DBExportFileBuilder. // // Parameters: // - requestContext: The context for the API request, including the host, user agent, username, and API key. // // Returns: // - DBExportFileBuilder: An instance of the DBExportFileBuilder interface. func NewGetDBExportFileBuilder(requestContext model.RequestContext) DBExportFileBuilder { return &getDBExportFile{ requestContext: requestContext, } } // getDBExportFile is an implementation of the DBExportFileBuilder interface. type getDBExportFile struct { requestContext model.RequestContext fileName string } // SetFile sets the name of the file to be retrieved. // // Parameters: // - fileName: The name of the exported database file. // // Returns: // - DBExportFileBuilder: The instance of the DBExportFileBuilder for method chaining. func (g *getDBExportFile) SetFile(fileName string) DBExportFileBuilder { g.fileName = fileName return g } // Execute sends the API request to retrieve the content of a specific exported database file. // // Returns: // - []byte: The content of the exported database file. // - error: An error, if any, encountered during the API request or response handling. func (g *getDBExportFile) Execute() ([]byte, error) { return endpoints.GetDBExportFile(g.requestContext, g.fileName) }