Documentation
¶
Index ¶
- type Client
- func (c *Client) Coachs(params map[string]interface{}) (*models.Coachs, error)
- func (c *Client) Fixture(params map[string]interface{}) (*models.FixturesResponse, error)
- func (c *Client) FixtureByDateAndLeague(leagueID, season int, fromDate time.Time, toDate time.Time) (*models.FixturesByDateResp, error)
- func (c *Client) FixtureHeadToHead(params map[string]interface{}) (*models.FixtureHeadToHeadResp, error)
- func (c *Client) FixtureStatistics(params map[string]interface{}) (*models.FixturesStatisticsResponse, error)
- func (c *Client) FixturesEvents(params map[string]interface{}) (*models.FixturesEventsResponse, error)
- func (c *Client) FixturesLineups(params map[string]interface{}) (*models.FixturesLineupsResponse, error)
- func (c *Client) FixturesPlayer(params map[string]interface{}) (*models.FixturesPlayersResponse, error)
- func (c *Client) Injuries(params map[string]interface{}) (*models.InjuriesResponse, error)
- func (c *Client) Leagues(params map[string]interface{}) (*models.LeaguesResponse, error)
- func (c *Client) Players(params map[string]interface{}) (*models.PlayersResponse, error)
- func (c *Client) PlayersSeasons(params map[string]interface{}) (*models.PlayersSeasonsResponse, error)
- func (c *Client) PlayersSquads(params map[string]interface{}) (*models.PlayersSquadsResponse, error)
- func (c *Client) PlayersTopAssists(params map[string]interface{}) (*models.PlayersTopResponse, error)
- func (c *Client) PlayersTopRedCards(params map[string]interface{}) (*models.PlayersTopResponse, error)
- func (c *Client) PlayersTopScorers(params map[string]interface{}) (*models.PlayersTopResponse, error)
- func (c *Client) PlayersTopYellowCards(params map[string]interface{}) (*models.PlayersTopResponse, error)
- func (c *Client) Search(q string, t Type) ([]byte, error)
- func (c *Client) Sidelined(params map[string]interface{}) (*models.SidelinedResponse, error)
- func (c *Client) Standings(params map[string]interface{}) (*models.StandingsResponse, error)
- func (c *Client) Teams(params map[string]interface{}) (*models.TeamsResponse, error)
- func (c *Client) TeamsStatistics(params map[string]interface{}) (*models.TeamsStatisticsResponse, error)
- func (c *Client) Transfers(params map[string]interface{}) (*models.TransfersResponse, error)
- func (c *Client) Trophies(params map[string]interface{}) (*models.TrophiesResponse, error)
- func (c *Client) Venues(params map[string]interface{}) (*models.VenuesResponse, error)
- type HttpClient
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { Domain string // contains filtered or unexported fields }
Client represents a client for the API-Football service. It holds the API key, the base domain URL, and the underlying HTTP client used to execute requests.
func New ¶
func New(key string, client HttpClient) (*Client, error)
New creates a new Client instance for the API-Football service using the default domain. It returns an error if the API key is missing or the provided HTTP client is nil.
func NewWithDomain ¶
func NewWithDomain(key, domain string, client HttpClient) (*Client, error)
NewWithDomain creates a new Client instance with a custom domain. It returns an error if the API key is missing or the provided HTTP client is nil.
func (*Client) Coachs ¶
Coachs hits the /coachs endpoint
- team: (Type: integer) The ID of the team. Value format: 85
- id: (Type: integer) The ID of the coach. Value format: 85
- search: (Type: string) The name of the coach. Value format: "John Doe" must be >= 3 characters one of the following parameters must be passed
func (*Client) Fixture ¶
func (c *Client) Fixture( params map[string]interface{}, ) (*models.FixturesResponse, error)
Fixture returns all fixtures for parameters passed
- id: (Type: integer) The ID of the fixture. Value format: 43.
- ids: (Type: strings) One or more fixture IDs. Value format: "id-id-id". Maximum of 20 fixture IDs.
- live: (Type: string) Enumerated values:
- "all": All leagues.
- "id-id": Specific league IDs (this is a placeholder; handle dynamically based on IDs).
- date: (Type: string) A valid date in the format YYYY-MM-DD.
- league: (Type: integer) The ID of the league.
- season: (Type: integer) (should be 4 digits) The season of the league. Format: 4 characters YYYY.
- team: (Type: integer) The ID of the team.
- last: (Type: integer) (<= 2 digis) For the X last fixtures. Value should be an integer with <= 2 characters.
- next: (Type: integer) (<= 2 digis) For the X next fixtures. Value should be an integer with <= 2 characters.
- from: (Type: string) A valid starting date for a date range. Format: YYYY-MM-DD.
- to: (Type: string) A valid ending date for a date range. Format: YYYY-MM-DD.
- round: (Type: string) The round of the fixture.
- status: (Type: string) Enumerated values:
- "NS": A specific fixture status.
- "NS-PST-FT": Combined fixture statuses.
- venue: (Type: integer) The venue ID of the fixture.
==================================================================================
func (*Client) FixtureByDateAndLeague ¶
func (c *Client) FixtureByDateAndLeague( leagueID, season int, fromDate time.Time, toDate time.Time, ) (*models.FixturesByDateResp, error)
FixtureByDateAndLeague returns all fixtures for a given date and league
func (*Client) FixtureHeadToHead ¶
func (c *Client) FixtureHeadToHead( params map[string]interface{}, ) (*models.FixtureHeadToHeadResp, error)
FixtureHeadToHead returns head to head for two teams
- h2h: (Type: string)(Required)(format id-id) The ids of the teams
- date (Type: string)(format YYYY-MM-DD) The date of the match
- league (Type: integer) The id of the league
- season (Type: integer)(4 digits)(format YYYY) The season of the league
- last (Type: integer) For the X last fixtures.
- next (Type: integer) For the X next fixtures.
- from (Type: string)(format YYYY-MM-DD) A valid starting date for a date range.
- to (Type: string)(format YYYY-MM-DD) A valid ending date for a date range.
- venue (Type: integer) The venue ID of the fixture.
- status (Type: string) Enumerated values:
- "NS": A specific fixture status.
- "NS-PST-FT": Combined fixture statuses.
func (*Client) FixtureStatistics ¶
func (c *Client) FixtureStatistics( params map[string]interface{}, ) (*models.FixturesStatisticsResponse, error)
FixtureStatistics returns statistics for a given fixture
- fixture (Type: integer)(Required) The ID of the fixture. Value format: 43.
- team (Type: integer) The ID of the team. Value format: 85.
func (*Client) FixturesEvents ¶
func (c *Client) FixturesEvents( params map[string]interface{}, ) (*models.FixturesEventsResponse, error)
FixturesEvents returns all events for a given fixture
- fixture: (Type: integer)(Required) The ID of the fixture. Value format: 43.
- team: (Type: integer) The ID of the team. Value format: 85.
- player: (Type: integer) The ID of the player. Value format: 85.
func (*Client) FixturesLineups ¶
func (c *Client) FixturesLineups( params map[string]interface{}, ) (*models.FixturesLineupsResponse, error)
FixturesLineups returns lineups for a given fixture
- fixture: (Type: integer)(Required) The ID of the fixture. Value format: 43.
- team: (Type: integer) The ID of the team. Value format: 85.
- player: (Type: integer) The ID of the player. Value format: 85.
func (*Client) FixturesPlayer ¶
func (c *Client) FixturesPlayer( params map[string]interface{}, ) (*models.FixturesPlayersResponse, error)
FixturesPlayer returns fixture's player data
- fixture (Type: integer)(Required) The ID of the fixture. Value format: 43.
- team (Type: integer) The ID of the team. Value format: 85.
func (*Client) Injuries ¶
func (c *Client) Injuries( params map[string]interface{}, ) (*models.InjuriesResponse, error)
Injuries hits the /injuries endpoint
league: (Type: integer) The ID of the league. Value format: 2
season: (Type: integer) (should be 4 digits) The year of the season. Value format: 2020
fixture: (Type: integer) The ID of the fixture. Value format: 157304
team: (Type: integer) The ID of the team. Value format: 85
player: (Type: integer) The ID of the player. Value format: 85
date: (Type: string) (format: YYYY-MM-DD) The date of the fixture. Value format: 2020-12-01
if league is provided, season is required if team is provided, season is required if player is provided, season is required
func (*Client) Leagues ¶
func (c *Client) Leagues( params map[string]interface{}, ) (*models.LeaguesResponse, error)
Leagues returns all leagues
- id (Type: integer) The ID of the league. Value format: 2
- name (Type: string) The name of the league. Value format: Premier League -country (Type: string) The name of the country. Value format: England
- season (Type: integer) (should be 4 digits) The year of the season. Value format: 2020
- team (Type: integer) The ID of the team. Value format: 85
- type (Type: string) The type of the league. Value format: League
- current (Type: string) Enum: (true, false) Return the list of active seasons or the last one of each competition. Value format: "true"
- search (Type: string) (should be 3 characters or more) The name of the league. Value format: Premier League
- last (Type: integer) (<= 2 digis) The X last leagues/cups added in the API
- code (Type: string) (2 characters) The code of the country. Value format: FR
func (*Client) Players ¶
func (c *Client) Players( params map[string]interface{}, ) (*models.PlayersResponse, error)
func (*Client) PlayersSeasons ¶
func (c *Client) PlayersSeasons( params map[string]interface{}, ) (*models.PlayersSeasonsResponse, error)
PlayersSeasons returns the seasons for a given player
- player (Type: integer) The ID of the player. Value format: 85
func (*Client) PlayersSquads ¶
func (c *Client) PlayersSquads( params map[string]interface{}, ) (*models.PlayersSquadsResponse, error)
func (*Client) PlayersTopAssists ¶
func (c *Client) PlayersTopAssists( params map[string]interface{}, ) (*models.PlayersTopResponse, error)
PlayersTopAssists returns the top assists for a given league and season
- league (Type: integer)(Required) The ID of the league. Value format: 2
- season (Type: integer)(Required) (4 digits) The year of the season. Value format: 2020
func (*Client) PlayersTopRedCards ¶
func (c *Client) PlayersTopRedCards( params map[string]interface{}, ) (*models.PlayersTopResponse, error)
PlayersTopRedCards returns the top assists for a given league and season
- league (Type: integer)(Required) The ID of the league. Value format: 2
- season (Type: integer)(Required) (4 digits) The year of the season. Value format: 2020
func (*Client) PlayersTopScorers ¶
func (c *Client) PlayersTopScorers( params map[string]interface{}, ) (*models.PlayersTopResponse, error)
PlayersTopScorers returns the top scorers for a given league and season
- league (Type: integer)(Required) The ID of the league. Value format: 2
- season (Type: integer)(Required) (4 digits) The year of the season. Value format: 2020
func (*Client) PlayersTopYellowCards ¶
func (c *Client) PlayersTopYellowCards( params map[string]interface{}, ) (*models.PlayersTopResponse, error)
PlayersTopYellowCards returns the top assists for a given league and season
- league (Type: integer)(Required) The ID of the league. Value format: 2
- season (Type: integer)(Required) (4 digits) The year of the season. Value format: 2020
func (*Client) Sidelined ¶
func (c *Client) Sidelined( params map[string]interface{}, ) (*models.SidelinedResponse, error)
func (*Client) Standings ¶
func (c *Client) Standings( params map[string]interface{}, ) (*models.StandingsResponse, error)
Standings hits the /standings endpoint
- season: (Type: integer) (Required) 4 characters YYYY The season of the standings. Value format: 2019
- league: (Type: integer) (Required) The ID of the league. Value format: 43
- team: (Type: integer) The ID of the team. Value format: 85
func (*Client) Teams ¶
func (c *Client) Teams( params map[string]interface{}, ) (*models.TeamsResponse, error)
Teams hits the /teams endpoint
-id: (Type: integer) The ID of the team. Value format: 85 - name: (Type: string) The name of the team. Value format: Arsenal - league: (Type: integer) The ID of the league. Value format: 2 - season: (Type: integer) (should be 4 digits) The year of the season. Value format: 2020 - country: (Type: string) The name of the country. Value format: England - code: (Type: string) (3 characters) The code of the team. Value format: ARS - venue: (Type: integer) The ID of the venue. Value format: 18 - search: (Type: string) (should be 3 characters or more) The name of the team. Value format: Arsenal At least one of the following parameters must be passed
func (*Client) TeamsStatistics ¶
func (c *Client) TeamsStatistics( params map[string]interface{}, ) (*models.TeamsStatisticsResponse, error)
TeamsStatistics hits the /teams/statistics endpoint
- league (Type: integer) (required) The ID of the league. Value format: 2
- season (Type: integer) (required) (should be 4 digits) The year of the season. Value format: 2020
- team (Type: integer) (required) The ID of the team. Value format: 85
- date (Type: string) (format: YYYY-MM-DD) The limit date. Value format: 2020-12-01
func (*Client) Transfers ¶
func (c *Client) Transfers( params map[string]interface{}, ) (*models.TransfersResponse, error)
Transfers hits the /transfers endpoint
- player (Type: integer) The ID of the player. Value format: 85
- team (Type: integer) The ID of the team. Value format: 85 At least one of the following parameters must be passed
func (*Client) Trophies ¶
func (c *Client) Trophies( params map[string]interface{}, ) (*models.TrophiesResponse, error)
Trophies hits the /trophies endpoint
player: (Type: integer) The ID of the player. Value format: 85
coach: (Type: integer) The ID of the coach. Value format: 85
At least one of the following parameters must be passed
func (*Client) Venues ¶
func (c *Client) Venues( params map[string]interface{}, ) (*models.VenuesResponse, error)
Venues hits the /venues endpoint
At least one of the following parameters must be passed:
- id: (Type: integer) The ID of the league. Value format: 4
- name: (Type: string) The name of the league. Value format: "OAKA Stadium"
- country: (Type: string) The name of the country. Value format: "Greece"
- city: (Type: string) The name of the city. Value format: "Athens"
- search (Type: string) The name of the venue. Value format: "OAKA Stadium" should be => 3 characters
type HttpClient ¶
HttpClient is an interface that abstracts the http.Client's Do method, allowing for easier testing and customization.