site

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2020 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package site publishes endpoints and handles web requests for a power-league site.

Index

Constants

View Source
const (
	// EarliestSupportedYear that fantasy leagues will be displayed for
	EarliestSupportedYear = 2001

	// LatestSupportedYear that fantasy leagues will be displayed for
	LatestSupportedYear = 2020
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ContextHandler

type ContextHandler struct {
	// The context being handled
	Context string

	// The function called when the context is accessed
	Func HandlerFunc
}

ContextHandler describes a context handled by this site

type HandlerFunc added in v0.3.0

type HandlerFunc func(s *Site, w http.ResponseWriter, r *http.Request)

HandlerFunc is a handler for a given site

type Site

type Site struct {
	// ServeMux for this site
	ServeMux *http.ServeMux
	// contains filtered or unexported fields
}

Site consists of the information needed to run a power rankings site

func NewSite

func NewSite(
	tls bool,
	baseContext string,
	staticFiles string,
	templatesDir string,
	trackingID string,
	s session.Manager) *Site

NewSite creates a new site

func (*Site) ContextHandler

func (s *Site) ContextHandler(id string, context string, f HandlerFunc)

ContextHandler adds a new handler for this site

func (*Site) GenerateURL added in v0.4.0

func (s *Site) GenerateURL(r *http.Request, context string) string

GenerateURL creates a URL to a location on the site based on an existing request

type YahooClient

type YahooClient struct {
	Client yahooGoffClient
}

YahooClient implements rankings.PowerRankingsClient

func (*YahooClient) GetAllTeamStats

func (y *YahooClient) GetAllTeamStats(leagueKey string, week int, projection bool) ([]goff.Team, error)

GetAllTeamStats gets teams stats for a given week from the Yahoo fantasy football API

func (*YahooClient) GetLeagueStandings added in v0.4.0

func (y *YahooClient) GetLeagueStandings(leagueKey string) (*goff.League, error)

GetLeagueStandings gets a league containing the current standings.

func (*YahooClient) GetMatchupsForWeekRange added in v0.4.0

func (y *YahooClient) GetMatchupsForWeekRange(leagueKey string, startWeek, endWeek int) (map[int][]goff.Matchup, error)

GetMatchupsForWeekRange returns a list of matchups for each week in the requested range.

Jump to

Keyboard shortcuts

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