hn

package
v0.2.13 Latest Latest
Warning

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

Go to latest
Published: May 26, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HN

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

HN represents a wrapper for HackerNews client

func New

func New(topics []string, w *worker.Worker) (*HN, error)

New creates a new HackerNews client

func (*HN) GetStoryCount

func (c *HN) GetStoryCount() int

func (*HN) Send added in v0.2.7

func (c *HN) Send(ctx context.Context) error

Send searches hacker news for specific topics and sends them to the provided email address.

type State

type State struct {
	Topics  []string  `json:"topics"`
	IDs     []int64   `json:"ids"`
	Stories []Story   `json:"stories"`
	Updated time.Time `json:"on"`
}

State represens Hacker News query.

func NewState

func NewState() *State

NewState creates a new state in a valid... wait for it... state.

func (*State) GetID

func (s *State) GetID() string

GetID returns the tweet ID.

func (*State) GetTopics

func (s *State) GetTopics() string

GetTopics returns the contaminated state topics.

type Story

type Story struct {
	// ID is the item's unique id.
	ID int64 `json:"id"`

	// Time is the creation date of the item, in Unix Time.
	Time int64 `json:"time"`

	// Author is the username of the item's author.
	Author string `json:"by"`

	// URL of the story.
	URL string `json:"url"`

	// Title of the story in HTML.
	Title string `json:"title"`

	// Score of the story, or the votes for a pollopt.
	Score int64 `json:"score"`
}

Story represens Hacker News story.

func (*Story) GetID

func (s *Story) GetID() string

GetID returns the tweet ID.

Jump to

Keyboard shortcuts

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