iago

package
v0.0.0-...-78c4eb8 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2023 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Sources []NewsSource `json:"sources"`
}

Config defines settings of app. Currently, the embedded file provides details of the news sources.

type NewsHandler

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

NewsHandler defines the type which stores and handles the feed data.

func (*NewsHandler) GetConfiguredSources

func (n *NewsHandler) GetConfiguredSources(config string) []NewsSource

GetConfiguredSources gets the news sources from the config data.

func (*NewsHandler) HandleNewsRequests

func (n *NewsHandler) HandleNewsRequests(w http.ResponseWriter, _ *http.Request)

HandleNewsRequests handles the incoming requests.

func (*NewsHandler) Init

func (n *NewsHandler) Init()

Init initializes the newsHandler struct.

func (*NewsHandler) UpdateFeed

func (n *NewsHandler) UpdateFeed(s NewsSource) error

UpdateFeed updates the news feed data content.

type NewsSource

type NewsSource struct {
	Url        string `json:"url"`
	ClientType string `json:"clientType"`
	Topic      string `json:"topic"`
	EntryCount int    `json:"entryCount"`
}

NewsSource defines the type which stores the details of a news source.

type RedditJsonType

type RedditJsonType struct {
	Kind string `json:"kind"`
	Data struct {
		Children []struct {
			Data struct {
				Title string `json:"title"`
				Id    string `json:"id"`
				Url   string `json:"url"`
			} `json:"data"`
		} `json:"children"`
	} `json:"data"`
}

RedditJsonType represents the json content received from the reddit website.

Jump to

Keyboard shortcuts

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