yfquery

package module
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2023 License: Apache-2.0 Imports: 9 Imported by: 2

README

Yahoo Fantasy Query Builders for Go

Go Reference License Go Report Card

Installation

go get github.com/famendola1/yfquery

Yahoo Endpoints

The Yahoo offical documentation for their Fantasy Sports API is not comprehensive and incomplete, despite being the offical. For a more complete overview of the supported endpoints, see the README.

Before You Start

The functionality of this package require the use of a *http.Client that is configured for the Yahoo Fantasy API endpoint. You can use the github.com/famendola1/yauth package to configure a *http.Client to use.

Query Builders

The query buiilders were designed to be able to easily generate queries for all the Yahoo Fantasy API endpoints. The builders expose functions that add pieces and parameters to the query. They also expose the following functions:

  • ToString: Builds the string for the query that the builder represents.
  • Get: Sends a GET request to the Yahoo Fantasy API for the endpoint that the query represents. A successful query will return a FantasyContent struct.
  • Post: Sends a POST request to the Yahoo Fantasy API for the endpoint that the query represents. A successful query will return a FantasyContent struct.
  • Put: Sends a PUT request to the Yahoo Fantasy API for the endpoint that the query represents. A successful query will return a FantasyContent struct.
  • Delete: Sends a DELETE request to the Yahoo Fantasy API for the endpoint that the query represents. A successful query will return a FantasyContent struct.
  • Reset: Clears all query parameters and the payload of the query. If Reset is called on a chained query builder (i.e. Transactions in League().Key("key").Transactions()), only the data on the chained query builder is cleared.

WARNING: The query builders do not validate that the queries they build are valid Yahoo endpoints.

Example Usages
// Get all the teams in a league.
Leagues().Key("nba.l.12345").Teams().Get(client)

// Search for a player and return their stats for the past week.
Leagues().Key("nba.l.12345").Players().Search("Donovan Mitchell").Stats().LastWeek().Get(client)

// Get all the leagues a user is in.
Users().Leagues().Get(client)

// Get the rosters for all teams in a league.
League().Key("nba.l.12345").Teams().Roster().Get(client)

// Get all the add and drop transactions in a league.
League().Key("nba.l.12345").Transactions().Types([]string{"add", "drop"}).Get(client)

// Add players to a team.
League().Key("nba.l.12345").Transactions().Add("nba.l.12345.t.1", "nba.p.6030").Post(client)

// Accept a trade.
Transaction().AcceptTrade("248.l.55438.pt.11", "deal!!").Put(client)

// Cancel a waiver claim.
Transaction().CancelWaiverClaim("248.l.55438.w.c.2_6093").Delete(client)

// Reset behavior
q := League().Key("nba.l.12345").Teams()

// /league/nba.l.12345/teams/roster
q.Roster().Get(client)

q.Reset()

// /league/nba.l.12345/teams/stats
q.Stats().Get(client)

Documentation

Index

Constants

View Source
const (
	PlayerStatusUnknown   PlayerStatus = ""
	PlayerStatusAvailable              = "A"
	PlayerStatusFreeAgent              = "FA"
	PlayerStatusWaiver                 = "W"
	PlayerStatusTaken                  = "T"
	PlayerStatusKeeper                 = "K"
)

Enum for a player's ownership status.

View Source
const (
	PlayerSortCriteriaUnknown       PlayerSortCriteria = ""
	PlayerSortCriteriaName                             = "NAME"
	PlayerSortCriteriaOverallRank                      = "OR"
	PlayerSortCriteriaActualRank                       = "AR"
	PlayerSortCriteriaFantasyPoints                    = "PTS"
)

Enum for player sort criteria.

View Source
const (
	PlayerSortTypeUnknown   PlayerSortType = ""
	PlayerSortTypeSeason                   = "season"
	PlayerSortTypeDate                     = "date"
	PlayerSortTypeWeek                     = "week"
	PlayerSortTypeLastMonth                = "lastmonth"
	PlayerSortTypeLastWeek                 = "lastweek"
)

Enum for player sort type.

Variables

This section is empty.

Functions

This section is empty.

Types

type GameQuery

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

GameQuery can be used to query the /games or /game Yahoo Fantasy endpoints.

func Game

func Game() *GameQuery

Game returns a GameQuery for the /game endpoint.

func Games

func Games() *GameQuery

Games returns a GameQuery for the /games endpoint.

func (*GameQuery) Codes

func (g *GameQuery) Codes(codes []string) *GameQuery

Codes adds the "game_codes" parameter with the given codes to the query. Any valid game code can be provided (incl. nba, nhl, nfl, mlb).

func (*GameQuery) Delete

func (q *GameQuery) Delete(client *http.Client) (*schema.FantasyContent, error)

Delete sends a "DELETE" request to the Yahoo Fantasy endpoint that the query would generate using the provided client along with the payload.

func (*GameQuery) GameWeeks

func (g *GameQuery) GameWeeks() *GameQuery

GameWeeks adds the "game_weeks" subresource to the request. If combined with other subresources, they are all combined into the "out" parameter, otherwise it is added to the request path (i.e. game/game_weeks).

func (*GameQuery) Get

func (q *GameQuery) Get(client *http.Client) (*schema.FantasyContent, error)

Get sends a "GET" request to the Yahoo Fantasy endpoint that the query would generate using the provided client.

func (*GameQuery) IsAvailable

func (g *GameQuery) IsAvailable() *GameQuery

IsAvailable adds the "is_available" parameter to the query.

func (*GameQuery) Key

func (g *GameQuery) Key(key string) *GameQuery

Key sets the "game_keys" parameter to the the given key. When querying the /game endpoint the key will be appended to the query path (i.e. /game/<key>).

func (*GameQuery) Keys

func (g *GameQuery) Keys(keys []string) *GameQuery

Keys adds the "game_keys" parameter with the given keys to the query.

func (*GameQuery) Leagues

func (g *GameQuery) Leagues() *LeagueQuery

Leagues returns a LeagueQuery for the /leagues subresource.

func (*GameQuery) Players

func (g *GameQuery) Players() *PlayerQuery

Players returns a PlayerQuery for the /teams subresource.

func (*GameQuery) PositionTypes

func (g *GameQuery) PositionTypes() *GameQuery

PositionTypes adds the "positions_types" subresource to the request. If combined with other subresources, they are all combined into the "out" parameter, otherwise it is added to the request path (i.e. game/position_types).

func (*GameQuery) Post

func (q *GameQuery) Post(client *http.Client) (*schema.FantasyContent, error)

Post sends a "POST" request to the Yahoo Fantasy endpoint that the query would generate using the provided client along with the payload.

func (*GameQuery) Put

func (q *GameQuery) Put(client *http.Client) (*schema.FantasyContent, error)

Put sends a "PUT" request to the Yahoo Fantasy endpoint that the query would generate using the provided client along with the payload.

func (*GameQuery) Reset

func (q *GameQuery) Reset()

func (*GameQuery) RosterPositions

func (g *GameQuery) RosterPositions() *GameQuery

RosterPositions adds the "roster_positions" subresource to the request. If combined with other subresources, they are all combined into the "out" parameter, otherwise it is added to the request path (i.e. game/roster_positions).

func (*GameQuery) Seasons

func (g *GameQuery) Seasons(seasons []int) *GameQuery

Seasons adds the "seasons" parameter with the given seasons to the query.

func (*GameQuery) StatCategories

func (g *GameQuery) StatCategories() *GameQuery

StatCategories adds the "stat_categories" subresource to the request. If combined with other subresources, they are all combined into the "out" parameter, otherwise it is added to the request path (i.e. game/stat_categories).

func (*GameQuery) Teams

func (g *GameQuery) Teams() *TeamQuery

Teams returns a TeamQuery for the /teams subresource.

func (*GameQuery) ToString

func (q *GameQuery) ToString() string

ToString generates the endpoint string for the query

func (*GameQuery) Types

func (g *GameQuery) Types(types []string) *GameQuery

Types adds the game_types parameter with the given types to the query. Valid game types are full|pickem-team|pickem-group|pickem-team-list.

type LeagueQuery

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

LeagueQuery can be used to query the /leagues or /league Yahoo Fantasy endpoints.

func League

func League() *LeagueQuery

League returns a LeagueQuery for the /league endpoint.

func Leagues

func Leagues() *LeagueQuery

Leagues returns a LeagueQuery for the /leagues endpoint.

func (*LeagueQuery) CurrentScoreboard

func (l *LeagueQuery) CurrentScoreboard() *LeagueQuery

CurrentScoreboard adds the "scoreboard" subresource to the request to query the scoreboard for the current week. If combined with other subresources, they are all combined into the "out" parameter, otherwise it is added to the request path (i.e. league/scoreboard).

func (*LeagueQuery) Delete

func (q *LeagueQuery) Delete(client *http.Client) (*schema.FantasyContent, error)

Delete sends a "DELETE" request to the Yahoo Fantasy endpoint that the query would generate using the provided client along with the payload.

func (*LeagueQuery) DraftResults

func (l *LeagueQuery) DraftResults() *LeagueQuery

DraftResults adds the "draftresults" subresource to the request. If combined with other subresources, they are all combined into the "out" parameter, otherwise it is added to the request path (i.e. league/draftresults).

func (*LeagueQuery) Get

func (q *LeagueQuery) Get(client *http.Client) (*schema.FantasyContent, error)

Get sends a "GET" request to the Yahoo Fantasy endpoint that the query would generate using the provided client.

func (*LeagueQuery) Key

func (l *LeagueQuery) Key(key string) *LeagueQuery

Key sets the league_keys parameter to the the given key. When querying the /league endpoint the key will be appended to the query path (i.e. /league/<key>).

func (*LeagueQuery) Keys

func (l *LeagueQuery) Keys(keys []string) *LeagueQuery

Keys adds the league_keys parameter with the given keys to the query.

func (*LeagueQuery) Players

func (l *LeagueQuery) Players() *PlayerQuery

Players returns a PlayerQuery for the /players subresource.

func (*LeagueQuery) PlayersWithDefaults

func (l *LeagueQuery) PlayersWithDefaults() *PlayerQuery

PlayersWithDefaults adds the "players" subresource to the request. If combined with other subresources, they are all combined into the "out" parameter, otherwise it is added to the request path (i.e. league/players).

func (*LeagueQuery) Post

func (q *LeagueQuery) Post(client *http.Client) (*schema.FantasyContent, error)

Post sends a "POST" request to the Yahoo Fantasy endpoint that the query would generate using the provided client along with the payload.

func (*LeagueQuery) Put

func (q *LeagueQuery) Put(client *http.Client) (*schema.FantasyContent, error)

Put sends a "PUT" request to the Yahoo Fantasy endpoint that the query would generate using the provided client along with the payload.

func (*LeagueQuery) Reset

func (q *LeagueQuery) Reset()

func (*LeagueQuery) Scoreboard

func (l *LeagueQuery) Scoreboard(week int) *LeagueQuery

Scoreboard adds the "scoreboard" subresource to the request. If combined with other subresources, they are all combined into the "out" parameter, otherwise it is added to the request path (i.e. league/scoreboard). week is expected by Yahoo to be a positive integer.

func (*LeagueQuery) Settings

func (l *LeagueQuery) Settings() *LeagueQuery

Settings adds the "settings" subresource to the request. If combined with other subresources, they are all combined into the "out" parameter, otherwise it is added to the request path (i.e. league/settings).

func (*LeagueQuery) Standings

func (l *LeagueQuery) Standings() *LeagueQuery

Standings adds the "standings" subresource to the request. If combined with other subresources, they are all combined into the "out" parameter, otherwise it is added to the request path (i.e. league/standings).

func (*LeagueQuery) Teams

func (l *LeagueQuery) Teams() *TeamQuery

Teams returns a TeamQuery for the /teams subresource.

func (*LeagueQuery) TeamsWithDefaults

func (l *LeagueQuery) TeamsWithDefaults() *TeamQuery

TeamsWithDefaults adds the "teams" subresource to the request. If combined with other subresources, they are all combined into the "out" parameter, otherwise it is added to the request path (i.e. league/teams).

func (*LeagueQuery) ToString

func (q *LeagueQuery) ToString() string

ToString generates the endpoint string for the query

func (*LeagueQuery) Transactions

func (l *LeagueQuery) Transactions() *TransactionQuery

Transactions returns a TransactionQuery for the /transactions subresource.

func (*LeagueQuery) TransactionsWithDefaults

func (l *LeagueQuery) TransactionsWithDefaults() *TransactionQuery

TransactionsWithDefaults adds the "teams" subresource to the request. If combined with other subresources, they are all combined into the "out" parameter, otherwise it is added to the request path (i.e. league/transactions).

type PlayerQuery

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

PlayerQuery can be used to query the /players or /player Yahoo Fantasy endpoints.

func Player

func Player() *PlayerQuery

Player returns a PlayerQuery for the /player endpoint.

func Players

func Players() *PlayerQuery

Players returns a PlayerQuery for the /players endpoint.

func (*PlayerQuery) Count

func (p *PlayerQuery) Count(count int) *PlayerQuery

Count adds the "count" parameter with the provided count to the query. count is expected by Yahoo to be a positive integer.

func (*PlayerQuery) Delete

func (q *PlayerQuery) Delete(client *http.Client) (*schema.FantasyContent, error)

Delete sends a "DELETE" request to the Yahoo Fantasy endpoint that the query would generate using the provided client along with the payload.

func (*PlayerQuery) DraftAnalysis

func (p *PlayerQuery) DraftAnalysis() *PlayerQuery

DraftAnalysis adds the "draft_analysis" subresource to the request. If combined with other subresources, they are all combined into the "out" parameter, otherwise it is added to the request path (i.e. player/draft_analysis).

func (*PlayerQuery) Get

func (q *PlayerQuery) Get(client *http.Client) (*schema.FantasyContent, error)

Get sends a "GET" request to the Yahoo Fantasy endpoint that the query would generate using the provided client.

func (*PlayerQuery) Key

func (p *PlayerQuery) Key(key string) *PlayerQuery

Key sets the "player_keys" parameter to the the given key. When querying the /game endpoint the key will be appended to the query path (i.e. /player/<key>).

func (*PlayerQuery) Keys

func (p *PlayerQuery) Keys(keys []string) *PlayerQuery

Keys adds the "player_keys" parameter with the given keys to the query.

func (*PlayerQuery) Opponent added in v0.1.5

func (p *PlayerQuery) Opponent() *PlayerQuery

Opponent adds the "opponent" subresource to the request. If combined with other subresources, they are all combined into the "out" parameter, otherwise it is added to the request path (i.e. player/opponent).

func (*PlayerQuery) Ownership

func (p *PlayerQuery) Ownership() *PlayerQuery

Ownership adds the "ownership" subresource to the request. If combined with other subresources, they are all combined into the "out" parameter, otherwise it is added to the request path (i.e. player/ownership).

func (*PlayerQuery) PercentOwned

func (p *PlayerQuery) PercentOwned() *PlayerQuery

PercentOwned adds the "percent_owned" subresource to the request. If combined with other subresources, they are all combined into the "out" parameter, otherwise it is added to the request path (i.e. player/percent_owned).

func (*PlayerQuery) Position

func (p *PlayerQuery) Position(pos string) *PlayerQuery

Position adds the "position" parameter with the provided position to the query. Valid player positions can be provided as input (e.x. "QB", "PG")

func (*PlayerQuery) Post

func (q *PlayerQuery) Post(client *http.Client) (*schema.FantasyContent, error)

Post sends a "POST" request to the Yahoo Fantasy endpoint that the query would generate using the provided client along with the payload.

func (*PlayerQuery) Put

func (q *PlayerQuery) Put(client *http.Client) (*schema.FantasyContent, error)

Put sends a "PUT" request to the Yahoo Fantasy endpoint that the query would generate using the provided client along with the payload.

func (*PlayerQuery) Reset

func (q *PlayerQuery) Reset()

func (*PlayerQuery) Search

func (p *PlayerQuery) Search(name string) *PlayerQuery

Search adds the "search" parameter with the provided name to the query.

func (*PlayerQuery) Sort

Sort adds the "sort" parameter with the provided sort criteria to the query.

func (*PlayerQuery) SortByStat added in v0.1.3

func (p *PlayerQuery) SortByStat(statID int) *PlayerQuery

SortByStat adds the "sort" parameter with the provided stat id to the query.

func (*PlayerQuery) SortDate

func (p *PlayerQuery) SortDate(date string) *PlayerQuery

SortDate adds the "sort_date" parameter with the provided date to the query. date should be formatted as YYYY-MM-DD.

func (*PlayerQuery) SortSeason

func (p *PlayerQuery) SortSeason(season int) *PlayerQuery

SortSeason adds the "sort_season" parameter with the provided season to the query.

func (*PlayerQuery) SortType

func (p *PlayerQuery) SortType(sortType PlayerSortType) *PlayerQuery

SortType adds the "sort_type" parameter with the provided type to the query.

func (*PlayerQuery) SortWeek

func (p *PlayerQuery) SortWeek(week int) *PlayerQuery

SortWeek adds the "sort_week" parameter with the provided week to the query. Yahoo only supports this parameter for football. week is expected by Yahoo to be a positive integer.

func (*PlayerQuery) Start

func (p *PlayerQuery) Start(start int) *PlayerQuery

Start adds the "start" parameter with the provided start to the query. start is expected by Yahoo to be a positive integer.

func (*PlayerQuery) Stats

func (p *PlayerQuery) Stats() *StatsQuery

Stats returns a StatsQuery for the /stats subresource.

func (*PlayerQuery) StatsWithDefaults

func (p *PlayerQuery) StatsWithDefaults() *PlayerQuery

StatsWithDefaults adds the "stats" subresource to the request. If combined with other subresources, they are all combined into the "out" parameter, otherwise it is added to the request path (i.e. player/stats).

func (*PlayerQuery) Status

func (p *PlayerQuery) Status(status PlayerStatus) *PlayerQuery

Status adds the "status" parameter with the provided status to the query.

func (*PlayerQuery) ToString

func (q *PlayerQuery) ToString() string

ToString generates the endpoint string for the query

type PlayerSortCriteria added in v0.1.3

type PlayerSortCriteria string

PlayerSortCriteria represents the sort criteria for players.

type PlayerSortType added in v0.1.3

type PlayerSortType string

PlayerSortType represent the sort type for players.

type PlayerStatus added in v0.1.3

type PlayerStatus string

PlayerStatus represents a player's ownership status.

type StatsQuery

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

StatsQuery can be used to query the /stats endpoint.

func Stats

func Stats() *StatsQuery

Stats returns a StatsQuery for the /stats subresource endpoint.

func (*StatsQuery) CurrentSeason

func (s *StatsQuery) CurrentSeason() *StatsQuery

CurrentSeason adds the "type=season" parameter to the query.

func (*StatsQuery) CurrentSeasonAverage

func (s *StatsQuery) CurrentSeasonAverage() *StatsQuery

CurrentSeasonAverage adds the "type=average_season" parameter to the query.

func (*StatsQuery) Day

func (s *StatsQuery) Day(date string) *StatsQuery

Day adds the "type=date" parameter and "date" parameter with the provided date to the query. date is expected to be formatted as YYYY-MM-DD.

func (*StatsQuery) Delete

func (q *StatsQuery) Delete(client *http.Client) (*schema.FantasyContent, error)

Delete sends a "DELETE" request to the Yahoo Fantasy endpoint that the query would generate using the provided client along with the payload.

func (*StatsQuery) Get

func (q *StatsQuery) Get(client *http.Client) (*schema.FantasyContent, error)

Get sends a "GET" request to the Yahoo Fantasy endpoint that the query would generate using the provided client.

func (*StatsQuery) LastMonth

func (s *StatsQuery) LastMonth() *StatsQuery

LastMonth adds the "type=lastmonth" parameter to the query.

func (*StatsQuery) LastMonthAverage

func (s *StatsQuery) LastMonthAverage() *StatsQuery

LastMonthAverage adds the "type=average_lastmonth" parameter to the query.

func (*StatsQuery) LastWeek

func (s *StatsQuery) LastWeek() *StatsQuery

LastWeek adds the "type=lastweek" parameter to the query.

func (*StatsQuery) LastWeekAverage

func (s *StatsQuery) LastWeekAverage() *StatsQuery

LastWeekAverage adds the "type=average_lastweek" parameter to the query.

func (*StatsQuery) Post

func (q *StatsQuery) Post(client *http.Client) (*schema.FantasyContent, error)

Post sends a "POST" request to the Yahoo Fantasy endpoint that the query would generate using the provided client along with the payload.

func (*StatsQuery) Put

func (q *StatsQuery) Put(client *http.Client) (*schema.FantasyContent, error)

Put sends a "PUT" request to the Yahoo Fantasy endpoint that the query would generate using the provided client along with the payload.

func (*StatsQuery) Reset

func (q *StatsQuery) Reset()

func (*StatsQuery) Season

func (s *StatsQuery) Season(season int) *StatsQuery

Season adds the "type=season" parameter and "season" parameter with the provided season to the query.

func (*StatsQuery) SeasonAverage

func (s *StatsQuery) SeasonAverage(season int) *StatsQuery

SeasonAverage adds the "type=average_season" parameter and "season" parameter with the provided season to the query.

func (*StatsQuery) ToString

func (q *StatsQuery) ToString() string

ToString generates the endpoint string for the query

func (*StatsQuery) Today

func (s *StatsQuery) Today() *StatsQuery

Today adds the "type=date" parameter to the query.

func (*StatsQuery) Week added in v0.1.3

func (s *StatsQuery) Week(week int) *StatsQuery

Week adds the "type=week" parameter to the query. Only supported by Yahoo for football.

type TeamQuery

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

TeamQuery can be used to query the /teams or /team Yahoo Fantasy resource.

func Team

func Team() *TeamQuery

Team returns a TeamQuery for the /team endpoint.

func Teams

func Teams() *TeamQuery

Teams returns a TeamQuery for the /teams endpoint.

func (*TeamQuery) AllMatchups

func (t *TeamQuery) AllMatchups() *TeamQuery

AllMatchups adds the "matchups" subresource to the request to request for all matchups. If combined with other subresources, they are all combined into the "out" parameter, otherwise it is added to the request path (i.e. team/matchups).

func (*TeamQuery) Delete

func (q *TeamQuery) Delete(client *http.Client) (*schema.FantasyContent, error)

Delete sends a "DELETE" request to the Yahoo Fantasy endpoint that the query would generate using the provided client along with the payload.

func (*TeamQuery) DraftResults

func (t *TeamQuery) DraftResults() *TeamQuery

DraftResults adds the "draftresults" subresource to the request. If combined with other subresources, they are all combined into the "out" parameter, otherwise it is added to the request path (i.e. team/draftresults).

func (*TeamQuery) Get

func (q *TeamQuery) Get(client *http.Client) (*schema.FantasyContent, error)

Get sends a "GET" request to the Yahoo Fantasy endpoint that the query would generate using the provided client.

func (*TeamQuery) Key

func (t *TeamQuery) Key(key string) *TeamQuery

Key sets the "team_keys" parameter to the the given key. When querying the /team endpoint the key will be appended to the query path (i.e. /team/<key>).

func (*TeamQuery) Keys

func (t *TeamQuery) Keys(keys []string) *TeamQuery

Keys adds the "team_keys" parameter with the given keys to the query.

func (*TeamQuery) Matchups

func (t *TeamQuery) Matchups(weeks []int) *TeamQuery

Matchups adds the "matchups" subresource to the request. If combined with other subresources, they are all combined into the "out" parameter, otherwise it is added to the request path (i.e. team/matchups). weeks is expected by Yahoo to contain positive integers.

func (*TeamQuery) PositionalRanks added in v0.1.5

func (t *TeamQuery) PositionalRanks() *TeamQuery

PositionalRanks adds the "positional_ranks" subresource to the request. If combined with other subresources, they are all combined into the "out" parameter, otherwise it is added to the request path (i.e. team/positional_ranks).

func (*TeamQuery) Post

func (q *TeamQuery) Post(client *http.Client) (*schema.FantasyContent, error)

Post sends a "POST" request to the Yahoo Fantasy endpoint that the query would generate using the provided client along with the payload.

func (*TeamQuery) Put

func (q *TeamQuery) Put(client *http.Client) (*schema.FantasyContent, error)

Put sends a "PUT" request to the Yahoo Fantasy endpoint that the query would generate using the provided client along with the payload.

func (*TeamQuery) RecommendedTradePartners added in v0.1.5

func (t *TeamQuery) RecommendedTradePartners() *TeamQuery

RecommendedTradePartners adds the "recommended_trade_partners" subresource to the request. If combined with other subresources, they are all combined into the "out" parameter, otherwise it is added to the request path (i.e. team/recommended_trade_partners).

func (*TeamQuery) Reset

func (q *TeamQuery) Reset()

func (*TeamQuery) Roster

func (t *TeamQuery) Roster() *TeamQuery

Roster adds the "roster" subresource to the request. If combined with other subresources, they are all combined into the "out" parameter, otherwise it is added to the request path (i.e. team/roster).

func (*TeamQuery) RosterDay

func (t *TeamQuery) RosterDay(date string) *TeamRosterQuery

RosterDay returns a TeamRosterQuery for the /roster subresource with the "date" parameter set to the provided date. date is expected to be formatted as YYYY-MM-DD.

func (*TeamQuery) RosterWeek

func (t *TeamQuery) RosterWeek(week int) *TeamRosterQuery

RosterWeek returns a TeamRosterQuery for the /roster subresource with the "week" parameter set to the provided week. week is expected by Yahoo to be a positive integer.

func (*TeamQuery) Standings

func (t *TeamQuery) Standings() *TeamQuery

Standings adds the "standings" subresource to the request. If combined with other subresources, they are all combined into the "out" parameter, otherwise it is added to the request path (i.e. team/standings).

func (*TeamQuery) Stats

func (t *TeamQuery) Stats() *StatsQuery

Stats returns a StatsQuery for the /stats subresource.

func (*TeamQuery) StatsWithDefaults

func (t *TeamQuery) StatsWithDefaults() *TeamQuery

StatsWithDefaults adds the "stats" subresource to the request. If combined with other subresources, they are all combined into the "out" parameter, otherwise it is added to the request path (i.e. team/stats).

func (*TeamQuery) ToString

func (q *TeamQuery) ToString() string

ToString generates the endpoint string for the query

type TeamRosterQuery

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

TeamRosterQuery can be used to query the /roster subresource of Game resource.

func (*TeamRosterQuery) Delete

func (q *TeamRosterQuery) Delete(client *http.Client) (*schema.FantasyContent, error)

Delete sends a "DELETE" request to the Yahoo Fantasy endpoint that the query would generate using the provided client along with the payload.

func (*TeamRosterQuery) Get

func (q *TeamRosterQuery) Get(client *http.Client) (*schema.FantasyContent, error)

Get sends a "GET" request to the Yahoo Fantasy endpoint that the query would generate using the provided client.

func (*TeamRosterQuery) Post

func (q *TeamRosterQuery) Post(client *http.Client) (*schema.FantasyContent, error)

Post sends a "POST" request to the Yahoo Fantasy endpoint that the query would generate using the provided client along with the payload.

func (*TeamRosterQuery) Put

func (q *TeamRosterQuery) Put(client *http.Client) (*schema.FantasyContent, error)

Put sends a "PUT" request to the Yahoo Fantasy endpoint that the query would generate using the provided client along with the payload.

func (*TeamRosterQuery) Reset

func (q *TeamRosterQuery) Reset()

func (*TeamRosterQuery) ToString

func (q *TeamRosterQuery) ToString() string

ToString generates the endpoint string for the query

type TransactionQuery

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

TransactionQuery can be used to query the /transactions or /transaction Yahoo Fantasy endpoints.

func Transaction

func Transaction() *TransactionQuery

Transaction returns a TransactionQuery for the /transaction endpoint.

func Transactions

func Transactions() *TransactionQuery

Transactions returns a TransactionQuery for the /transactions endpoint.

func (*TransactionQuery) AcceptTrade

func (t *TransactionQuery) AcceptTrade(transactionKey, note string) *TransactionQuery

AcceptTrade set the payload of the query to perform an accept trade action. Use the Put method to send this payload. This payload works with the /transaction endpoint.

func (*TransactionQuery) Add

func (t *TransactionQuery) Add(teamKey, playerKey string) *TransactionQuery

Add sets the payload of the query to an "add" transaction. Use the Post method to send the payload. This payload works with the /transactions endpoint.

func (*TransactionQuery) AddDrop

func (t *TransactionQuery) AddDrop(teamKey, addPlayerKey, dropPlayerKey string) *TransactionQuery

AddDrop sets the payload of the query to an "add/drop" transaction. Use the Post method to send the payload. This payload works with the /transactions endpoint.

func (*TransactionQuery) AllowTrade

func (t *TransactionQuery) AllowTrade(transactionKey string) *TransactionQuery

AllowTrade set the payload of the query to perform an allow trade action. Use the Put method to send this payload. This payload works with the /transaction endpoint.

func (*TransactionQuery) CancelTrade

func (t *TransactionQuery) CancelTrade(transactionKey string) *TransactionQuery

CancelTrade set the payload of the query to perform a cancel trade action. Use the Delete method to send this payload. This payload works with the /transaction endpoint.

func (*TransactionQuery) CancelWaiverClaim

func (t *TransactionQuery) CancelWaiverClaim(transactionKey string) *TransactionQuery

CancelWaiverClaim set the payload of the query to perform a cancel waiver claim action. Use the Delete method to send this payload. This payload works with the /transaction endpoint.

func (*TransactionQuery) Count

func (t *TransactionQuery) Count(count int) *TransactionQuery

Count adds the "count" parameter with the given count to the query. count is expected by Yahoo to be a positive integer.

func (*TransactionQuery) Delete

func (q *TransactionQuery) Delete(client *http.Client) (*schema.FantasyContent, error)

Delete sends a "DELETE" request to the Yahoo Fantasy endpoint that the query would generate using the provided client along with the payload.

func (*TransactionQuery) DisallowTrade

func (t *TransactionQuery) DisallowTrade(transactionKey string) *TransactionQuery

DisallowTrade set the payload of the query to perform a disallow trade action. Use the Put method to send this payload. This payload works with the /transaction endpoint.

func (*TransactionQuery) Drop

func (t *TransactionQuery) Drop(teamKey, playerKey string) *TransactionQuery

Drop sets the payload of the query to a "drop" transaction. Use the Post method to send the payload. This payload works with the /transactions endpoint.

func (*TransactionQuery) Get

func (q *TransactionQuery) Get(client *http.Client) (*schema.FantasyContent, error)

Get sends a "GET" request to the Yahoo Fantasy endpoint that the query would generate using the provided client.

func (*TransactionQuery) Key

Key sets the "transaction_keys" parameter to the the given key. When querying the /transaction endpoint the key will be appended to the query path (i.e. /transaction/<key>).

func (*TransactionQuery) Keys

func (t *TransactionQuery) Keys(keys []string) *TransactionQuery

Keys adds the "transaction_keys" parameter with the given keys to the query.

func (*TransactionQuery) Post

func (q *TransactionQuery) Post(client *http.Client) (*schema.FantasyContent, error)

Post sends a "POST" request to the Yahoo Fantasy endpoint that the query would generate using the provided client along with the payload.

func (*TransactionQuery) Put

func (q *TransactionQuery) Put(client *http.Client) (*schema.FantasyContent, error)

Put sends a "PUT" request to the Yahoo Fantasy endpoint that the query would generate using the provided client along with the payload.

func (*TransactionQuery) RejectTrade

func (t *TransactionQuery) RejectTrade(transactionKey, note string) *TransactionQuery

RejectTrade set the payload of the query to perform a reject trade action. Use the Put method to send this payload. This payload works with the /transaction endpoint.

func (*TransactionQuery) Reset

func (q *TransactionQuery) Reset()

func (*TransactionQuery) TeamKey

func (t *TransactionQuery) TeamKey(key string) *TransactionQuery

TeamKey adds the "team_key" parameter with the provided key to the query.

func (*TransactionQuery) ToString

func (q *TransactionQuery) ToString() string

ToString generates the endpoint string for the query

func (*TransactionQuery) Types

func (t *TransactionQuery) Types(types []string) *TransactionQuery

Types sets the "transaction_types" parameter with the given types to the query. Valid types are add,drop,commish,trade.

func (*TransactionQuery) UpdateWaiverClaim

func (t *TransactionQuery) UpdateWaiverClaim(transactionKey string, priority, faab int) *TransactionQuery

UpdateWaiverClaim set the payload of the query to perform a waiver claim update on priority and FAAB. Use the Put method to send this payload. This payload works with the /transaction endpoint.

func (*TransactionQuery) UpdateWaiverClaimFAAB

func (t *TransactionQuery) UpdateWaiverClaimFAAB(transactionKey string, faab int) *TransactionQuery

UpdateWaiverClaimFAAB set the payload of the query to perform a waiver claim update on FAAB. Use the Put method to send this payload. This payload works with the /transaction endpoint.

func (*TransactionQuery) UpdateWaiverClaimPriority

func (t *TransactionQuery) UpdateWaiverClaimPriority(transactionKey string, priority int) *TransactionQuery

UpdateWaiverClaimPriority set the payload of the query to perform a waiver claim update on priority. Use the Put method to send this payload. This payload works with the /transaction endpoint.

func (*TransactionQuery) VoteAgainstTrade

func (t *TransactionQuery) VoteAgainstTrade(transactionKey, voterTeamKey string) *TransactionQuery

VoteAgainstTrade set the payload of the query to perform a vote against trade action. Use the Put method to send this payload. This payload works with the /transaction endpoint.

type UserQuery

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

UserQuery can be used to query the /users Yahoo Fantasy endpoint.

func Users

func Users() *UserQuery

Users returns a UserQuery for the /users endpoint.

func (*UserQuery) Delete

func (q *UserQuery) Delete(client *http.Client) (*schema.FantasyContent, error)

Delete sends a "DELETE" request to the Yahoo Fantasy endpoint that the query would generate using the provided client along with the payload.

func (*UserQuery) Games

func (u *UserQuery) Games() *GameQuery

Games returns a GameQuery for the /games subresource.

func (*UserQuery) Get

func (q *UserQuery) Get(client *http.Client) (*schema.FantasyContent, error)

Get sends a "GET" request to the Yahoo Fantasy endpoint that the query would generate using the provided client.

func (*UserQuery) Leagues

func (u *UserQuery) Leagues() *LeagueQuery

Leagues returns a GameQuery for the /leagues subresource.

func (*UserQuery) Post

func (q *UserQuery) Post(client *http.Client) (*schema.FantasyContent, error)

Post sends a "POST" request to the Yahoo Fantasy endpoint that the query would generate using the provided client along with the payload.

func (*UserQuery) Put

func (q *UserQuery) Put(client *http.Client) (*schema.FantasyContent, error)

Put sends a "PUT" request to the Yahoo Fantasy endpoint that the query would generate using the provided client along with the payload.

func (*UserQuery) Reset

func (q *UserQuery) Reset()

func (*UserQuery) Teams

func (u *UserQuery) Teams() *TeamQuery

Teams returns a TeamQuery for the /teams subresource.

func (*UserQuery) ToString

func (q *UserQuery) ToString() string

ToString generates the endpoint string for the query

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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