ostatus

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package ostatus implements queries that operate on statuses (tweets) using the Twitter API v1.1.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateOpts

type CreateOpts struct {
	// Record the update as a reply to this tweet ID.  This will be ignored
	// unless the update text includes an @mention of the author of that tweet.
	InReplyTo string

	// Ask the server to automatically populate the reply target and mentions.
	AutoPopulateReply bool

	// User IDs to exclude when auto-populating mentions.
	AutoExcludeMentions []string

	// Optional tweet fields to report with a successful update.
	Optional types.TweetFields
}

CreateOpts provides parameters for tweet creation. A nil *CreateOpts provides zero values for all fields.

type Options

type Options struct {
	Optional types.TweetFields
}

Options provides parameters for tweet modification. A nil *Options provides zero values for all fields.

type Query

type Query struct {
	*jape.Request
	// contains filtered or unexported fields
}

Query is a query to post, delete, like, or retweet a status update.

func Create

func Create(text string, opts *CreateOpts) Query

Create constructs a status update ("tweet") with the given text. This query requires user-context authorization.

API: 1.1/statuses/update.json

func Delete

func Delete(id string, opts *Options) Query

Delete constructs a query to delete ("destroy") a tweet with the given ID. This query requires user-context authorization.

API: 1.1/statuses/destroy/:id.json

func Like

func Like(id string, opts *Options) Query

Like constructs a query to like ("favorite") a tweet with the given ID. This query requires user-context authorization.

API: 1.1/favorites/create.json

func Retweet

func Retweet(id string, opts *Options) Query

Retweet constructs a query to retweet a tweet with the given ID. This query requires user-context authorization.

API: 1.1/statuses/retweet/:id.json

func Unlike

func Unlike(id string, opts *Options) Query

Unlike constructs a query to un-like ("unfavorite") a tweet with the given ID. This query requires user-context authorization.

API: 1.1/favorites/destroy.json

func Unretweet

func Unretweet(id string, opts *Options) Query

Unretweet constructs a query to un-retweet a tweet with the given ID. This query requires user-context authorization.

API: 1.1/statuses/unretweet/:id.json

func (Query) Invoke

func (o Query) Invoke(ctx context.Context, cli *twitter.Client) (*Reply, error)

Invoke posts the update and reports the resulting tweet.

type Reply

type Reply struct {
	Data   []byte
	Tweets []*types.Tweet
}

A Reply is the response from a Query or TimelineQuery.

type TimelineOpts

type TimelineOpts struct {
	// Look up the user by ID instead of by username.
	ByID bool

	// The maximum number of results to return (limit 200).
	// If zero, use the server default.
	MaxResults int

	// Exclude replies from the reported timeline.
	ExcludeReplies bool

	// Include native retweets in the reported timeline.
	IncludeRetweets bool

	// Include entities in the response.
	IncludeEntities bool

	// If set, return results with IDs greater than this (exclusive).
	SinceID string

	// If set, return results with IDs smaller than this (exclusive).
	UntilID string

	// Optional tweet fields to report with the result.
	Optional types.TweetFields
}

TimelineOpts provides parameters for timeline queries. A nil *TimelineOpts provides zero values for all fields.

type TimelineQuery

type TimelineQuery struct {
	*jape.Request
	// contains filtered or unexported fields
}

TimelineQuery is a query to fetch a timeline of tweets.

func HomeTimeline

func HomeTimeline(id string, opts *TimelineOpts) TimelineQuery

HomeTimeline constructs a query for the specified user's home timeline. This request requres user-context authorization.

API: 1.1/statuses/home_timeline.json

func MentionsTimeline

func MentionsTimeline(id string, opts *TimelineOpts) TimelineQuery

MentionsTimeline constructs a query for the user's mentions timeline. This request requires user-context authorization.

API: 1.1/statuses/mentions_timeline.json

func UserTimeline

func UserTimeline(id string, opts *TimelineOpts) TimelineQuery

UserTimeline constructs a query for the specified user's timeline.

API: 1.1/statuses/user_timeline.json

func (TimelineQuery) Invoke

func (o TimelineQuery) Invoke(ctx context.Context, cli *twitter.Client) (*Reply, error)

Invoke posts the query and reports the matching tweets.

Jump to

Keyboard shortcuts

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