Documentation
¶
Index ¶
- type Add
- type AddCommand
- type DeleteId
- type DeleteIdCommand
- type DeleteValue
- type DeleteValueCommand
- type Meta
- type RuleData
- type RulesError
- type RulesResponse
- type Service
- func (s *Service) AddRule(ctx context.Context, cmd AddCommand, dryRun bool) (RulesResponse, client.RateLimitSnapshot, error)
- func (s *Service) DeleteRule(ctx context.Context, cmd DeleteIdCommand, dryRun bool) (RulesResponse, client.RateLimitSnapshot, error)
- func (s *Service) GetRules(ctx context.Context) (RulesResponse, client.RateLimitSnapshot, error)
- func (s *Service) Stream(ctx context.Context, fields map[string]string) (StreamEnvelope, client.RateLimitSnapshot, error)
- func (s *Service) StreamReader(ctx context.Context, fields map[string]string, handler TweetHandler) error
- type StreamEnvelope
- type StreamIncludes
- type StreamMeta
- type StreamResponse
- type StreamTweet
- type StreamUser
- type Summary
- type TweetHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddCommand ¶
type AddCommand struct {
Add []Add `json:"add"`
}
func CreateAddCommand ¶
func CreateAddCommand(values map[string]string) AddCommand
type DeleteIdCommand ¶
type DeleteIdCommand struct {
Delete DeleteId `json:"delete"`
}
func CreateDeleteIdCommand ¶
func CreateDeleteIdCommand(ids []string) DeleteIdCommand
type DeleteValue ¶
type DeleteValue struct {
Values []string `json:"values"`
}
type DeleteValueCommand ¶
type DeleteValueCommand struct {
Delete DeleteValue `json:"delete"`
}
func CreateDeleteValueCommand ¶
func CreateDeleteValueCommand(rules []string) DeleteValueCommand
type RulesError ¶
type RulesResponse ¶
func AddRule ¶
func AddRule(ctx context.Context, c *client.Client, cmd AddCommand, dryRun bool) (RulesResponse, client.RateLimitSnapshot, error)
AddRule is a convenience wrapper that delegates to the Service abstraction.
func GetRules ¶
func GetRules(ctx context.Context, c *client.Client) (RulesResponse, client.RateLimitSnapshot, error)
GetRules is a convenience wrapper that delegates to the Service abstraction.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service coordinates filtered stream operations against the Twitter API.
func NewService ¶
NewService returns a Service backed by the provided client.
func (*Service) AddRule ¶
func (s *Service) AddRule(ctx context.Context, cmd AddCommand, dryRun bool) (RulesResponse, client.RateLimitSnapshot, error)
AddRule creates a new filtered stream rule.
func (*Service) DeleteRule ¶
func (s *Service) DeleteRule(ctx context.Context, cmd DeleteIdCommand, dryRun bool) (RulesResponse, client.RateLimitSnapshot, error)
DeleteRule removes filtered stream rules by ID.
func (*Service) GetRules ¶
func (s *Service) GetRules(ctx context.Context) (RulesResponse, client.RateLimitSnapshot, error)
GetRules retrieves the current filtered stream rules.
func (*Service) Stream ¶
func (s *Service) Stream(ctx context.Context, fields map[string]string) (StreamEnvelope, client.RateLimitSnapshot, error)
Stream fetches filtered stream results using the provided expansion fields.
func (*Service) StreamReader ¶
func (s *Service) StreamReader(ctx context.Context, fields map[string]string, handler TweetHandler) error
StreamReader connects to the filtered stream and processes tweets in real-time.
type StreamEnvelope ¶
type StreamEnvelope struct {
Data []StreamTweet `json:"data"`
Includes StreamIncludes `json:"includes"`
Errors []RulesError `json:"errors,omitempty"`
Meta StreamMeta `json:"meta,omitempty"`
}
StreamEnvelope captures a response from the filtered stream endpoint.
func Stream ¶
func Stream(ctx context.Context, c *client.Client, fields map[string]string) (StreamEnvelope, client.RateLimitSnapshot, error)
Stream is a convenience wrapper that constructs a Service on the fly and proxies to its Stream method. New code should prefer using a shared Service instance directly so that HTTP client configuration can be reused.
type StreamIncludes ¶
type StreamIncludes struct {
Users []StreamUser `json:"users,omitempty"`
}
StreamIncludes captures expanded entities such as users.
type StreamMeta ¶
type StreamMeta struct {
ResultCount int `json:"result_count"`
}
StreamMeta carries additional metadata from the endpoint.
type StreamResponse ¶
type StreamTweet ¶
type StreamTweet struct {
ID string `json:"id"`
Text string `json:"text"`
AuthorID string `json:"author_id"`
CreatedAt time.Time `json:"created_at"`
PossiblySensitive bool `json:"possibly_sensitive"`
Source string `json:"source"`
Lang string `json:"lang"`
}
StreamTweet represents a Tweet entry in the filtered stream.
type StreamUser ¶
type StreamUser struct {
ID string `json:"id"`
Name string `json:"name"`
Username string `json:"username"`
CreatedAt time.Time `json:"created_at"`
}
StreamUser represents a user record included alongside tweets.
type TweetHandler ¶
type TweetHandler func(tweet StreamTweet, includes StreamIncludes) error
TweetHandler is a function that processes tweets from the stream. Return an error to stop the stream.