Documentation ¶
Overview ¶
app package provides the core interface for ajtweet. It is used in decoupling from the CLI and thus makes it easier to unit-test.
Index ¶
- Variables
- type Application
- func (app *Application) AcquireLock() error
- func (app *Application) Add(message string, scheduledTimeString string) error
- func (app *Application) Configure(config Config) error
- func (app *Application) Delete(idString string) error
- func (app *Application) DeleteAll() error
- func (app *Application) List(out io.Writer) error
- func (app *Application) ListJSON(out io.Writer) error
- func (app *Application) ReleaseLock() error
- func (app *Application) Save() error
- func (app *Application) Send(out io.Writer, dryRun bool) error
- type Authentication
- type Config
- type Datastore
- type OAuth1
- type Send
Constants ¶
This section is empty.
Variables ¶
var (
ErrLockfileExists = errors.New("another instance is running and have acquired the lock file")
)
var ( // The tweet has already been added to the list. ErrMissingAuth = errors.New("authentication parameters are missing") )
Functions ¶
This section is empty.
Types ¶
type Application ¶
type Application struct {
// contains filtered or unexported fields
}
The main "context" used in the application.
func (*Application) AcquireLock ¶
func (app *Application) AcquireLock() error
func (*Application) Add ¶
func (app *Application) Add(message string, scheduledTimeString string) error
Add a new scheduled tweet to the Application. The scheduledTimeString must be in the RFC 3339 standard, e.g. 2006-03-05T10:42:01Z
func (*Application) Configure ¶
func (app *Application) Configure(config Config) error
Configure and load any exsiting tweets to be used by the Application.
func (*Application) Delete ¶
func (app *Application) Delete(idString string) error
Delete the tweet matching the specified identifier.
func (*Application) List ¶
func (app *Application) List(out io.Writer) error
Write the list of scheduled tweets that still need to be sent to the specified io.Writer.
func (*Application) ListJSON ¶
func (app *Application) ListJSON(out io.Writer) error
Write the list of scheduled tweets that still need to be sent in a JSON encoding to the specified io.Writer.
func (*Application) ReleaseLock ¶
func (app *Application) ReleaseLock() error
func (*Application) Save ¶
func (app *Application) Save() error
Save any changes made by the Application.
type Authentication ¶
type Authentication struct { APIKey string `mapstructure:"api_key"` // Consumer / API Key APISecret string `mapstructure:"api_secret"` // Consumer / API Secret OAuth1 OAuth1 }
Authentication details for the Twitter API
type Config ¶
type Config struct { Datastore Datastore Send Send Lockfile string // File path of where the lock file will be created. }
Configuration data used by the Application.
func (*Config) PopulateFromEnv ¶
func (config *Config) PopulateFromEnv()
Configure values from matching environment variables
type Datastore ¶
type Datastore struct {
Filepath string // File path of where the tweets should be stored.
}
Datastore configures how the tweets are stored by the Application.
type Send ¶
type Send struct { Max int // The maximum number of tweets to send in this call of the app. Delay int // The number of seconds to delay between each sending of a tweet. Authentication Authentication }
Send parameters