New creates a new ImageFetcher with the provided transport
(config *Config)
| 22 | |
| 23 | // New creates a new ImageFetcher with the provided transport |
| 24 | func New(config *Config) (*Fetcher, error) { |
| 25 | if err := config.Validate(); err != nil { |
| 26 | return nil, err |
| 27 | } |
| 28 | |
| 29 | transport, err := transport.New(&config.Transport) |
| 30 | if err != nil { |
| 31 | return nil, err |
| 32 | } |
| 33 | |
| 34 | return &Fetcher{transport, config}, nil |
| 35 | } |
| 36 | |
| 37 | // BuildRequest creates a new [Request] with the provided context, URL, headers, and cookie jar |
| 38 | func (f *Fetcher) BuildRequest( |