squantified

package
v0.0.0-...-27497b2 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reading

type Reading struct {
	Authors       []*ReadingAuthor `toml:"authors"`
	ID            int              `toml:"id"`
	ISBN          string           `toml:"isbn"`
	ISBN13        string           `toml:"isbn13"`
	NumPages      int              `toml:"num_pages"`
	PublishedYear int              `toml:"published_year"`
	ReadAt        time.Time        `toml:"read_at"`
	Rating        int              `toml:"rating"`
	Review        string           `toml:"review"`
	ReviewHTML    template.HTML    `toml:"-"`
	ReviewID      int              `toml:"review_id"`
	Title         string           `toml:"title"`

	// AuthorsDisplay is just the names of all authors combined together for
	// display on a page.
	AuthorsDisplay string `toml:"-"`
}

Reading is a single Goodreads book stored to a TOML file.

func GetReadingsData

func GetReadingsData(c *modulir.Context, target string) ([]*Reading, error)

type ReadingAuthor

type ReadingAuthor struct {
	ID   int    `toml:"id"`
	Name string `toml:"name"`
}

ReadingAuthor is a single Goodreads author stored to a TOML file.

func (*ReadingAuthor) UnmarshalText

func (a *ReadingAuthor) UnmarshalText(data []byte) error

Only kicks in if the author value is a single string. Otherwise the full object is unmarshaled into the struct.

type ReadingDB

type ReadingDB struct {
	Readings []*Reading `toml:"readings"`
}

ReadingDB is a database of Goodreads readings stored to a TOML file.

type Tweet

type Tweet struct {
	CreatedAt     time.Time      `toml:"created_at"`
	Entities      *TweetEntities `toml:"entities"`
	FavoriteCount int            `toml:"favorite_count"`
	ID            int64          `toml:"id"`
	Reply         *TweetReply    `toml:"reply"`
	Retweet       *TweetRetweet  `toml:"retweet"`
	RetweetCount  int            `toml:"retweet_count"`
	Text          string         `toml:"text"`

	// Images are the URLs of all images associated with a given tweet, if
	// any.
	Images []TweetImage `toml:"-"`

	// ReplyOrMention is assigned to tweets which are either a direct mention
	// or reply, and which therefore don't go in the main timeline. It gives us
	// an easy way to access this information from a template.
	ReplyOrMention bool `toml:"-"`

	// TextHTML is Text rendered to HTML using a variety of special Twitter
	// rules. It's rendered once and added to the struct so that it can be
	// reused across multiple pages.
	TextHTML template.HTML `toml:"-"`
}

Tweet is a single tweet stored to a TOML file.

func ReadTwitterData

func ReadTwitterData(c *modulir.Context, source string) ([]*Tweet, error)

ReadTwitterData reads Twitter data from a TOML data file and does a little bit of post-processing to add some convenience properties and an HTML rendering of each tweet.

type TweetDB

type TweetDB struct {
	Tweets []*Tweet `toml:"tweets"`
}

TweetDB is a database of tweets stored to a TOML file.

type TweetEntities

type TweetEntities struct {
	Medias       []*TweetEntitiesMedia       `toml:"medias"`
	URLs         []*TweetEntitiesURL         `toml:"urls"`
	UserMentions []*TweetEntitiesUserMention `toml:"user_mentions"`
}

TweetEntities contains various multimedia entries that may be contained in a tweet.

type TweetEntitiesMedia

type TweetEntitiesMedia struct {
	ID   int64  `toml:"id"`
	Type string `toml:"type"`
	URL  string `toml:"url"`
	// contains filtered or unexported fields
}

TweetEntitiesMedia is an image or video stored in a tweet.

func (*TweetEntitiesMedia) OriginalExt

func (p *TweetEntitiesMedia) OriginalExt() string

type TweetEntitiesURL

type TweetEntitiesURL struct {
	DisplayURL  string `toml:"display_url"`
	ExpandedURL string `toml:"expanded_url"`
	URL         string `toml:"url"`
}

TweetEntitiesURL is a URL referenced in a tweet.

type TweetEntitiesUserMention

type TweetEntitiesUserMention struct {
	User   string `toml:"user"`
	UserID int64  `toml:"user_id"`
}

TweetEntitiesUserMention is another user being mentioned in a tweet.

type TweetImage

type TweetImage struct {
	URL       string
	URLRetina string
}

type TweetMonth

type TweetMonth struct {
	Month  time.Month
	Tweets []*Tweet
}

TweetMonth holds a collection of tweets grouped by year.

type TweetMonthCount

type TweetMonthCount struct {
	Count int       `json:"count"`
	Month time.Time `json:"month"`
}

func GetTwitterByMonth

func GetTwitterByMonth(tweets []*Tweet) []*TweetMonthCount

type TweetReply

type TweetReply struct {
	StatusID int64  `toml:"status_id"`
	User     string `toml:"user"`
	UserID   int64  `toml:"user_id"`
}

TweetReply is populated with reply information for when a tweet is a reply.

type TweetRetweet

type TweetRetweet struct {
	StatusID int64  `toml:"status_id"`
	User     string `toml:"user"`
	UserID   int64  `toml:"user_id"`
}

TweetRetweet is populated with retweet information for when a tweet is a retweet.

type TweetYear

type TweetYear struct {
	Year   int
	Months []*TweetMonth
}

TweetYear holds a collection of tweetMonths grouped by year.

func GroupTwitterByYearAndMonth

func GroupTwitterByYearAndMonth(tweets []*Tweet) []*TweetYear

Jump to

Keyboard shortcuts

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