Documentation ¶
Index ¶
- type ChristopherStory
- func (cs *ChristopherStory) EnableDebrider() *ChristopherStory
- func (cs *ChristopherStory) EnableDownloader() *ChristopherStory
- func (cs *ChristopherStory) Scenario() *Scenario
- func (cs *ChristopherStory) SetConfig(config *config.Config) *ChristopherStory
- func (cs *ChristopherStory) SetNotifier(notifierFunc func(event *Event) error) *ChristopherStory
- func (cs *ChristopherStory) SetTeller(teller *teller.Teller) *ChristopherStory
- type Event
- type Scenario
- func (s *Scenario) CurrentStep() *Step
- func (s *Scenario) From(name string) *Step
- func (s *Scenario) NextStep() *Step
- func (s *Scenario) OnEnd(callback func()) *Scenario
- func (s *Scenario) OnStart(callback func()) *Scenario
- func (s *Scenario) Play(event *Event)
- func (s *Scenario) RunError() error
- func (s *Scenario) SetCurrentStep(step *Step)
- func (s *Scenario) SetInitialStep(step string) error
- type Step
- func (s *Step) Do(doFunc func(event *Event) error) *Step
- func (s *Step) From() string
- func (s *Step) If(conditionFunc func() bool) *Step
- func (s *Step) Next() string
- func (s *Step) OnEnd(onEndFunc func()) *Step
- func (s *Step) OnStart(onStartFunc func()) *Step
- func (s *Step) Run(event *Event) error
- func (s *Step) To(nextStep string) *Step
- type Story
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChristopherStory ¶
type ChristopherStory struct {
// contains filtered or unexported fields
}
ChristopherStory is a story to handle a new URI
Currenty, it does the following:
- Checking if URI is debridable - If URI is debridable:
- Debriding the URI using default debrider
- Sending debrided URI to downloader
- If URI is not debridable:
- Sending URI to downloader
- Notifying the user about the download event
func (*ChristopherStory) EnableDebrider ¶
func (cs *ChristopherStory) EnableDebrider() *ChristopherStory
EnableDebrider enables the debrider for the story play
func (*ChristopherStory) EnableDownloader ¶
func (cs *ChristopherStory) EnableDownloader() *ChristopherStory
EnableDownloader enables the downloader for the story play
func (*ChristopherStory) Scenario ¶
func (cs *ChristopherStory) Scenario() *Scenario
Scenario is the main scenario of ChristopherStory
func (*ChristopherStory) SetConfig ¶
func (cs *ChristopherStory) SetConfig(config *config.Config) *ChristopherStory
SetConfig sets a given config instead of the default one
func (*ChristopherStory) SetNotifier ¶
func (cs *ChristopherStory) SetNotifier(notifierFunc func(event *Event) error) *ChristopherStory
SetNotifier defines a nofier for the story
func (*ChristopherStory) SetTeller ¶
func (cs *ChristopherStory) SetTeller(teller *teller.Teller) *ChristopherStory
SetTeller boots the story teller
type Event ¶
type Event struct { Value string // A valid URI Origin string // Previous handler (submitter, debrider, downloader…) }
Event represents an event going through the Story
type Scenario ¶
type Scenario struct {
// contains filtered or unexported fields
}
Scenario handle URIs accross the application
func (*Scenario) CurrentStep ¶
CurrentStep returns the current scenario step
func (*Scenario) SetCurrentStep ¶
SetCurrentStep updates the scenario current step
func (*Scenario) SetInitialStep ¶
SetInitialStep defines the first step for the scenario
type Step ¶
type Step struct {
// contains filtered or unexported fields
}
Step is a step during a Scenario
func (*Step) If ¶
If defines an execution condition for current step
NOTE conditionFunc is a callback evaluated at runtime. You may want to wrap your step in a if condition if you don't need such a dynamic evaluation.