twitter

package
v0.17.6 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Credentials

type Credentials struct {
	ConsumerKey       string
	ConsumerSecret    string
	AccessToken       string
	AccessTokenSecret string
}

Credentials contains the authentication credentials needed for twitter api access

ConsumerKey and ConsumerSecret can be thought of as the user name and password that represents your Twitter developer app when making API requests.

An access token and access token secret are user-specific credentials used to authenticate OAuth 1.0a API requests. They specify the Twitter account the request is made on behalf of.

See https://developer.twitter.com/en/docs/authentication/oauth-1-0a for more details

type Twitter

type Twitter struct {
	// contains filtered or unexported fields
}

Twitter struct holds necessary data to communicate with the Twitter API

func New

func New(credentials Credentials) (*Twitter, error)

New returns a new instance of a Slack notification service. For more information about slack api token:

-> https://pkg.go.dev/github.com/slack-go/slack#New

func (*Twitter) AddReceivers

func (t *Twitter) AddReceivers(twitterIDs ...string)

AddReceivers takes TwitterIds and adds them to the internal twitterIDs list.

func (Twitter) Send

func (t Twitter) Send(ctx context.Context, subject, message string) error

Send takes a message subject and a message body and sends them to all previously set twitterIDs as a DM. See https://developer.twitter.com/en/docs/twitter-api/v1/direct-messages/sending-and-receiving/api-reference/new-event

Jump to

Keyboard shortcuts

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