twtr

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2022 License: Unlicense Imports: 12 Imported by: 0

Documentation

Overview

Package twtr is the backend to the twtr twtxt client.

go get duriny.envs.sh/twtr/pkg

This serves as an API and backend for the command line client, but also allows custom frontends to be built around it. See the cmd package for the reference frontend.

Index

Constants

View Source
const Version = "v0.2.0"

Version of the twtr client.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// Timeout for all network activity, defaults to no timeout.
	Timeout time.Duration

	// Feed to write tweets to, if unset, tweets will be discarded.
	Feed io.Writer

	// PreTweet is a Hook that is executed directly before a tweet is posted.
	PreTweet Hook

	// PostTweet is a Hook that is executed, directly after a tweet is posted.
	PostTweet Hook
}

Client is an instance of the twtr client.

Configure the client as desired.

func (*Client) Post

func (client *Client) Post(tweet string) error

Post a new tweet on this client, running the pre/post tweet hooks along the way, return any error that occurs.

type Hook

type Hook func(*Client) error

Hook into an event of a client, a nil hook is treated as a noop.

Note, a hook may be called more than once, this should be taken into account if necessary.

func ShellHook

func ShellHook(command string) Hook

ShellHook creates a hook from a shell command, the command is executed against the system shell environment when the hook is called.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL