Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type NewsItem ¶
type NewsItem struct { ID string `json:"id"` CreateTime int64 `json:"createtime"` Text string `json:"text"` MediaURL string `json:"mediaurl"` MediaData string `json:"mediadata"` StoryURL string `json:"storyurl"` }
NewsItem represents a single news item
type NewsItems ¶ added in v1.0.15
type NewsItems []NewsItem
func (NewsItems) Len ¶ added in v1.0.15
Let NewsItems know how to sort by implementing the sort interface (https://pkg.go.dev/sort#Interface):
type NewsReport ¶
NewsReport defines a news report
func GetNewsReport ¶
func GetNewsReport(ctx context.Context, services []NewsService) NewsReport
GetNewsReport calls all services in parallel and returns the first result
type NewsService ¶
type NewsService interface { // GetNewsReport gets the news report GetNewsReport(ctx context.Context) (NewsReport, error) }
NewsService is the interface for all services that can fetch news data
type Tweet ¶ added in v1.0.10
type Tweet struct { Text string `json:"text"` CreatedAt time.Time `json:"created_at"` Entities struct { Annotations []struct { Start int `json:"start"` End int `json:"end"` Probability float64 `json:"probability"` Type string `json:"type"` NormalizedText string `json:"normalized_text"` } `json:"annotations"` Urls []struct { Start int `json:"start"` End int `json:"end"` URL string `json:"url"` ExpandedURL string `json:"expanded_url"` DisplayURL string `json:"display_url"` } `json:"urls"` } `json:"entities"` ID string `json:"id"` }
Tweet represents an individual tweet
type TwitterCNNService ¶ added in v1.0.6
type TwitterCNNService struct{}
TwitterCNNService represents the CNN news service
func (TwitterCNNService) GetNewsReport ¶ added in v1.0.6
func (s TwitterCNNService) GetNewsReport(ctx context.Context) (NewsReport, error)
GetNewsReport gets breaking news from CNN
type TwitterTimelineResponse ¶ added in v1.0.10
type TwitterTimelineResponse struct { Tweets []Tweet `json:"data"` Meta struct { OldestID string `json:"oldest_id"` NewestID string `json:"newest_id"` ResultCount int `json:"result_count"` NextToken string `json:"next_token"` } `json:"meta"` }
TwitterTimelineResponse represents the response to a timeline request
Click to show internal directories.
Click to hide internal directories.