Categorygithub.com/forestmb/goff
modulepackage
0.4.0
Repository: https://github.com/forestmb/goff.git
Documentation: pkg.go.dev

# README

goff GoDoc Build Status Coverage Status

goff is a library for communicating with the Yahoo Fantasy Sports APIs.

This application is written using the Go programming language and is licensed under the New BSD license.

Building

$ go get https://github.com/Forestmb/goff
$ cd $GOPATH/src/github.com/Forestmb/goff
$ ./build.sh

To make sure this build runs before every commit, use:

$ ln -s "$(pwd)/build.sh" .git/hooks/pre-commit

Debug

The goff/debug package can be used to help with developing goff. It uses the OAuth 2.0 configuraiton provided by goff to make arbitrary GET request to the Yahoo Fantasy Sports APIs and outputs the string XML response. To run:

$ cd $GOPATH/src/github.com/Forestmb/goff
$ go run debug/debug.go --clientKey=<key> --clientSecret=<secret> --redirectURL=<redirect-url>

The values key and secret can be obtained after registering your own applicaiton: http://developer.yahoo.com/fantasysports/guide/GettingStarted.html

The redirect-url must match the callback domain given when registering the application with Yahoo. For development, using 127.0.0.1 for the domain and http://127.0.0.1 as the redirect URL should suffice.

# Packages

Command debug starts a terminal based fantasy client using the OAuth consumer provided by package goff.

# Functions

GetConsumer generates an OAuth Consumer for the Yahoo fantasy sports API.
GetOAuth2Config generates an OAuth 2 configuration for the Yahoo fantasy sports API.
NewCachedClient creates a new fantasy client that checks and updates the given Cache when retrieving fantasy content.
NewClient creates a Client that to communicate with the Yahoo fantasy sports API.
NewLRUCache creates a new Cache that caches content for the given client for up to the maximum duration.

# Constants

NflGameKey represents the current year's Yahoo fantasy football game.
YahooAuthTokenURL is used to create OAuth authorization tokens.
YahooBaseURL is the base URL for all calls to Yahoo's fantasy sports API.
YahooGetTokenURL is used to get the OAuth access token used when making calls to the fantasy sports API.
YahooOauth2AuthURL is uesd to start the OAuth 2 login process.
YahooOauth2TokenURL is used to create OAuth 2 access tokens used when making calls to the fantasy sports API.
YahooRequestTokenURL is used to create OAuth request tokens.

# Variables

ErrAccessDenied is returned when the user does not have permision to access the requested resource.
YearKeys is map of a string year to the string Yahoo uses to identify the fantasy football game for that year.

# Structs

Client is an application authorized to use the Yahoo fantasy sports API.
FantasyContent is the root level response containing the data from a request to the fantasy sports API.
Game represents a single year in the Yahoo fantasy football ecosystem.
A League is a uniquely identifiable group of players and teams.
LRUCache implements Cache utilizing a LRU cache and unique keys to cache content for up to a maximum duration.
LRUCacheValue implements lru.Value to be able to store fantasy content in a LRUCache.
A Manager is a user in change of a given team.
A Matchup is a collection of teams paired against one another for a given week.
Name is a name of a player.
A Player is a single player for the given sport.
Points represents scoring statistics for a time period specified by CoverageType.
Record is the number of wins, losses, and ties for a given team in their league.
A Roster is the set of players belonging to one team for a given week.
Scoreboard represents the matchups that occurred for one or more weeks.
SelectedPosition is the position chosen for a Player for a given week.
Settings describes how a league is configured.
A Team is a participant in exactly one league.
TeamLogo is a image for a given team.
TeamStandings describes how a single Team ranks in their league.
User contains the games a user is participating in.

# Interfaces

Cache sets and retrieves fantasy content for request URLs based on the time for which the content was valid.
ContentProvider returns the data from an API request.
HTTPClient defines methods needed to communicated with a service over HTTP.