in internal/conn/conn.go [46:74]
func New(httpClient *http.Client, store *storage.Client, clientErrs chan error, options ...Option) (*Service, error) {
if httpClient == nil {
return nil, fmt.Errorf("httpClient is required")
}
if store == nil {
return nil, fmt.Errorf("store is required")
}
if clientErrs == nil {
return nil, fmt.Errorf("clientErrs is required")
}
conn := &Service{
in: make(chan models.Notifications, 1),
http: httpClient,
store: store,
clientErrs: clientErrs,
}
for _, o := range options {
if err := o(conn); err != nil {
return nil, err
}
}
go conn.sender()
return conn, nil
}