Lyo.Espn.Fantasy.Football.Client
3.0.0
dotnet add package Lyo.Espn.Fantasy.Football.Client --version 3.0.0
NuGet\Install-Package Lyo.Espn.Fantasy.Football.Client -Version 3.0.0
<PackageReference Include="Lyo.Espn.Fantasy.Football.Client" Version="3.0.0" />
<PackageVersion Include="Lyo.Espn.Fantasy.Football.Client" Version="3.0.0" />
<PackageReference Include="Lyo.Espn.Fantasy.Football.Client" />
paket add Lyo.Espn.Fantasy.Football.Client --version 3.0.0
#r "nuget: Lyo.Espn.Fantasy.Football.Client, 3.0.0"
#:package Lyo.Espn.Fantasy.Football.Client@3.0.0
#addin nuget:?package=Lyo.Espn.Fantasy.Football.Client&version=3.0.0
#tool nuget:?package=Lyo.Espn.Fantasy.Football.Client&version=3.0.0
Lyo.Espn.Fantasy.Football.Client
Typed client for ESPN fantasy football. League reads use lm-api-reads, transaction writes use lm-api-writes, Fantasy Chat uses lm-api-communication, and player news uses
site.api.espn.com. It subclasses LyoHttpClient and sends a browser User-Agent on every request so the chat host does not return 403.
Examples
Wire into DI (Extensions.cs)
services.AddFantasyFootballClientFromConfiguration(builder.Configuration);
// or:
services.AddFantasyFootballClient(o => {
o.EspnS2 = "...";
o.Swid = "{...}";
});
Manager surface
FantasyFootballClient exposes four manager properties; seasons before 2018 are rejected (checked by ValidateSeason).
| Property | Manager | Calls |
|---|---|---|
League |
LeagueManager |
GetAsync(leagueId, seasonId) (settings + teams + standings; also fills the in-memory league index), GetTeamsAsync (rosters for each scoring period), GetTeamAsync (one team), GetDraftAsync (draft picks), GetMatchupsAsync (scoreboard), GetBoxScoreAsync (one matchup with a typed roster). |
Players |
PlayerManager |
GetInfoAsync(leagueId, seasonId, query) (player cards through kona_playercard; writes the player cache), GetPlayerAsync (one player), GetAsync(leagueId, seasonId, playerIds) (cached cards, fetching only the misses), GetFreeAgentsAsync (kona_player_info for FREEAGENT and WAIVERS), GetNewsAsync (fantasy news feed). |
Communication |
CommunicationManager |
GetLeagueChatAsync (lists Fantasy Chat topics on lm-api-communication, then loads each conversation; pass a LeagueRes or a league id and season), GetConversationAsync (one topic; newest 25 messages by default; same league overload), LoadPlayersAsync (one player-card request for a conversation you already loaded), GetRecentActivityAsync (adds/drops/trades feed through kona_league_communication), PostMessageAsync (user text, messageTypeId 0). ChatMessageBuilder.For(ChatTopics.AllMembers) posts to the league chat. ChatMessageBuilder.To(member) posts to that member's direct message. The post response is a one-element array; the method returns that message. |
Transactions |
TransactionsManager |
GetRecentAsync (mTransactions2 view, optional type filter), GetRecentTradesAsync (TRADE_* shorthand), GetPendingAsync (mPendingTransactions), PostTransactionAsync, SetLineupAsync, AddDropAsync, CancelWaiverAsync, ProposeTradeAsync, RespondToTradeAsync. Lineup moves accept LineupSlot (Bench is 20, Quarterback is 0). |
FantasyFilterReqBuilder builds x-fantasy-filter JSON. Write bodies come from
LineupTransactionBuilder, RosterTransactionBuilder,
TradeTransactionBuilder, and ChatMessageBuilder. The manager methods post Build(); they do not
assemble the ESPN JSON themselves.
Remember (also called from League.GetAsync) replaces LeagueIndex: members by SWID, teams by id and primary owner. FindMember
and FindTeam match one display name, team name, abbreviation, or "Location Nickname". Author LM is the league manager. PlayerCache stores cards by season
and player id. ToItemViewsAsync returns a structured copy of a transaction and does not change that ESPN record.
ChatMessageRes is the chat message a conversation returns. Raw ids and unix times keep a suffix: AuthorId, DateUnix, DateEditedUnix,
ViewableByIds, TeamId, and PlayerId. The unsuffixed name is the friendly value: Author and Members are league members, Date and DateEdited are timestamps, Team is
the league team, and Player is the card. Kind is Text, AddDrop, Trade, or Unknown. A trade (ESPN type 271, or keys such as team1addP* / team2addP* / team1dropP* /
team2dropP* / tId) has Side1, Side2, a transaction id, and every numbered player in numeric order. An add/drop (ESPN type 266, or addP* / dropP*) keeps every pickup and
drop on side 1. Types 0 and 270 are text. GetLeagueChatAsync and GetConversationAsync accept a league or a league id and season. They bind the ESPN JSON with the normal
serializer and copy it onto these models. Author, Members, and Team are filled from the league index when it already has them. Loading the league later does not change a chat
object you already have. They do not fetch cards. Communication.LoadPlayersAsync fills Player with one request. Author stays null for LM.
ChatTopics holds AllMembers and DirectMessage. ChatMessageBuilder.For takes one of those.
ChatMessageBuilder.To takes a member, a SWID, or a unique display name and posts to the existing direct message.
Request types sit under Models/Request (PlayerInfoQuery, ChatConversationQuery, RecentActivityQuery, TransactionsQuery, FantasyFilterReq,
FantasyTransactionReq, ChatMessageReq). Response types sit under Models/Response (LeagueRes, TeamRes, MatchupRes, MatchupRosterRes,
PlayerInfoItemRes, PlayerNewsFeedRes, TransactionRes, ChatConversationRes, ChatMessageRes). ChatConversationRes is that topic,
with the same id-and-model pairs.
Settings (FantasyFootballClientOptions)
Binds from section FantasyFootballClient. Picks up the LyoHttpClientOptions flags and adds:
| Property | Description |
|---|---|
EspnS2 |
Optional espn_s2 cookie value. Needed for private leagues. |
Swid |
Optional SWID cookie value. Needed for private leagues. |
CommunicationBaseUrl |
Fantasy Chat host root. Defaults to https://lm-api-communication.fantasy.espn.com/apis/v3/games/ffl/. |
WritesBaseUrl |
Lineup, waiver, and trade host root. Defaults to https://lm-api-writes.fantasy.espn.com/apis/v3/games/ffl/. |
NewsBaseUrl |
Fantasy player news URL. Defaults to https://site.api.espn.com/apis/fantasy/v3/games/ffl/news/players. |
UserAgent.Enabled |
On by default. Sends the Chrome agent from LyoHttpUserAgentOptions on every request. The chat host returns 403 without it. |
BaseUrl defaults to https://lm-api-reads.fantasy.espn.com/apis/v3/games/ffl/. CommunicationBaseUrl defaults to the Fantasy Chat host. WritesBaseUrl defaults to the writes
host. NewsBaseUrl is the news feed URL. Public leagues skip cookies; both cookie values must be set before the client attaches them. Chat posts require Swid.
Wire into DI (Extensions.cs)
| Method | Description |
|---|---|
AddFantasyFootballClientFromConfiguration(configuration, sectionName?) |
Reads FantasyFootballClientOptions from configuration (default section "FantasyFootballClient"). |
AddFantasyFootballClient(Action<FantasyFootballClientOptions> configure) |
Constructs options in place. |
AddFantasyFootballClient(FantasyFootballClientOptions options) |
Takes a ready-made options object. |
Every overload registers FantasyFootballClient as a singleton and takes ILoggerFactory plus any registered HttpClient from DI.
Dependencies
Generated from ProjectReference / PackageReference (same model as docs/Lyo.ProjectGraph.html).
Lyo.Http.Client(direct, lyo)Lyo.Json(direct, lyo)Lyo.Metrics(direct, lyo)Microsoft.Extensions.DependencyInjection.Abstractions10.0.5(direct, microsoft)Microsoft.Extensions.Http10.0.5(direct, microsoft)Microsoft.Extensions.Logging.Abstractions10.0.5(direct, microsoft)Lyo.Common.Core(transitive, lyo)Lyo.Common.Metadata(transitive, lyo)Lyo.DataTable.Models(transitive, lyo)Lyo.Exceptions(transitive, lyo)Lyo.RateLimit(transitive, lyo)Lyo.Result(transitive, lyo)AngleSharp1.5.0(transitive, third-party)Microsoft.Bcl.AsyncInterfaces10.0.5(transitive, microsoft, netstandard2.0)Microsoft.Bcl.TimeProvider8.0.1(transitive, microsoft, netstandard2.0)Microsoft.Extensions.Configuration.Binder10.0.5(transitive, microsoft)System.Memory4.6.3(transitive, microsoft, netstandard2.0)System.Text.Encoding.CodePages10.0.5(transitive, microsoft)System.Text.Json10.0.5(transitive, microsoft, netstandard2.0)System.Threading.RateLimiting10.0.5(transitive, microsoft)
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Lyo.Http.Client (>= 3.0.0)
- Lyo.Json (>= 3.0.0)
- Lyo.Metrics (>= 3.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.5)
- Microsoft.Extensions.Http (>= 10.0.5)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.5)
-
net10.0
- Lyo.Http.Client (>= 3.0.0)
- Lyo.Json (>= 3.0.0)
- Lyo.Metrics (>= 3.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.5)
- Microsoft.Extensions.Http (>= 10.0.5)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.5)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Lyo.Espn.Fantasy.Football.Client:
| Package | Downloads |
|---|---|
|
Lyo.FantasyFootball.Api
HTTP API for fantasy football chats and trades. Reads the plugin store and syncs through the ESPN client. |
GitHub repositories
This package is not used by any popular GitHub repositories.