diff --git a/flixkit.go b/flixkit.go index a916310..78264a0 100644 --- a/flixkit.go +++ b/flixkit.go @@ -8,7 +8,6 @@ import ( "io/fs" "log" "net/http" - "os" ) type Generator interface { Generate(flix *FlowInteractionTemplate, templateLocation string, isLocal bool) (string, error) @@ -21,17 +20,6 @@ type FlixService interface { GetFlixByID(ctx context.Context, templateID string) (*FlowInteractionTemplate, error) } -// OsFileReader is a real implementation that calls os.ReadFile. -type OsFileReader struct{} - -func (o OsFileReader) ReadFile(filename string) ([]byte, error) { - return os.ReadFile(filename) -} - -func (o OsFileReader) Open(filename string) (fs.File, error) { - return os.Open(filename) -} - type flixServiceImpl struct { config *Config } @@ -46,10 +34,6 @@ func NewFlixService(config *Config) FlixService { config.FlixServerURL = "https://flix.flow.com/v1/templates" } - if config.FileReader == nil { - config.FileReader = OsFileReader{} - } - return &flixServiceImpl{ config: config, } @@ -127,11 +111,3 @@ func FetchFlixWithContext(ctx context.Context, url string) (string, error) { return string(body), nil } - -func FetchFlixWithContextFromFile(ctx context.Context, reader fs.ReadFileFS, url string) (string, error) { - body, err := reader.ReadFile(url) - if err != nil { - log.Fatalf("Failed to read file: %v", err) - } - return string(body), nil -}