aggregator

package module
Version: v0.0.0-...-98e87cd Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2021 License: Apache-2.0 Imports: 7 Imported by: 1

README

PersonalNewsletter - Aggregator

This directory is there to aggregate different data from all over the web. All modules return a Module struct (definied in types.go) and an error.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Button

type Button struct {
	Text string `json:"text"` // Button text
	URL  string `json:"url"`  // Button URL
}

type Image

type Image struct {
	Text string `json:"text"`   // Image text
	URL  string `json:"source"` // Image source URL
	X    int64  `json:"x"`      // Image X size
	Y    int64  `json:"y"`      // Image Y size
}
type Link struct {
	Text string `json:"text"` // Link text
	URL  string `json:"url"`  // Link URL
}

Basically the same as a button, but a Module can contain multiple. They are below the text.

type Module

type Module struct {
	Caption string `json:"caption"`            // Title of the module
	Image   Image  `json:"image"`              // Image of the module - optional
	Text    string `json:"text"`               // Text of the module - optional
	Links   []Link `json:"links"`              // Collection of links - optional (ex. RSS feed)
	Button  Button `json:"button",omitonempty` // Button of the module - optional
}

The output of a module. Several of these make up an email

func FetchHoroscope

func FetchHoroscope(sign string) (Module, error)

func FetchQuoteOfTheDay

func FetchQuoteOfTheDay() (Module, error)

func FetchRssFeed

func FetchRssFeed(url string, count int) (Module, error)

type OhmandaRes

type OhmandaRes struct {
	Text string `json:"horoscope"`
}

type QUTDResponse

type QUTDResponse struct {
	Success struct {
		Total int `json:"total"`
	} `json:"success"`
	Contents struct {
		Quotes []struct {
			Quote    string `json:"quote"`
			Author   string `json:"author"`
			Language string `json:"language"`
		} `json:"quotes"`
	} `json:"contents"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL