sportmonks

package module
v0.0.0-...-d304636 Latest Latest
Warning

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

Go to latest
Published: May 3, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

README

Build Status Go Report Card License

golang-sportmonks

Golang wrapper for the Sportmonks Soccer API

Pull requests are welcome!

Installation

$ go get github.com/szybia/go-sportmonks

Usage

package main

import (
	"fmt"
	"log"

	sm "github.com/szybia/go-sportmonks"
)

func main() {
	sm.SetAPIToken("<YOUR_TOKEN_HERE>")
	g, err := sm.Get("fixtures/between/2016-01-01/2018-01-01", "", 0, false)
	//  Can also use sportmonks globals for code clarity and readability
	//  g, err := sm.Get("fixtures/between/2016-01-01/2018-01-01", sm.NoIncludes, sm.FirstOrAllPages, sm.SinglePage)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(string(g))
}
  • Contains functions for all Sportmonks endpoints as well as base custom Get function
g, err := sm.Leagues("", 0, true)
g, err := sm.Seasons("", 0, true)
g, err := sm.LivescoresNow(sm.NoIncludes)
  • Contains build in logger which is used for goroutine errors. Logger can be altered to requirements
f, err := os.OpenFile("sportmonks_log.txt", os.O_CREATE|os.O_APPEND, 0666)
if err != nil {
	log.Fatal(err)
}
sm.Logger.SetOutput(f)
//Code...

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllPages = true

AllPages specifies to fetch all pages available for that request

View Source
var FirstOrAllPages = 0

FirstOrAllPages specifies the default when a specific page is not requested this default should be used when requesting the first page or all pages

View Source
var Logger = log.Logger{}

Logger is a dedicated sportmonks logger

View Source
var NoIncludes = ""

NoIncludes specifies the default of no includes

View Source
var SinglePage = false

SinglePage specifies to only fetch a single page for the request

Functions

func Bookmaker

func Bookmaker(ID int) ([]byte, error)

Bookmaker fetches bookmaker specified by ID

func Bookmakers

func Bookmakers() ([]byte, error)

Bookmakers fetches all bookmakers

func Coach

func Coach(ID int) ([]byte, error)

Coach fetches a squad specified by ID

func CommentariesFixture

func CommentariesFixture(ID int) ([]byte, error)

CommentariesFixture fetches textual representations of events within a fixture

func Continent

func Continent(ID int, include string) ([]byte, error)

Continent request for continent identified by supplied ID

func Continents

func Continents(include string) ([]byte, error)

Continents request for all continents

func Countries

func Countries(include string, page int, allPages bool) ([]byte, error)

Countries request for all countries

func Country

func Country(ID int, include string) ([]byte, error)

Country request for specific country identified by ID

func Fixture

func Fixture(ID int, include string) ([]byte, error)

Fixture request for specific fixture identified by ID

func FixturesDate

func FixturesDate(date string, include string, page int, allPages bool) ([]byte, error)

FixturesDate fetches fixtures played at a specific date

func FixturesFromToDate

func FixturesFromToDate(fromDate, toDate string, include string, page int, allPages bool) ([]byte, error)

FixturesFromToDate fetches fixtures played between the specified dates

func FixturesFromToDateTeam

func FixturesFromToDateTeam(fromDate, toDate string, teamID int, include string, page int, allPages bool) ([]byte, error)

FixturesFromToDateTeam fetches all fixtures between the specified dates for the team identified by teamID

func FixturesMultipleIntList

func FixturesMultipleIntList(IDs []int, include string) ([]byte, error)

FixturesMultipleIntList fetches all fixtures with IDs contained in the supplied int slice

func FixturesMultipleList

func FixturesMultipleList(IDs, include string) ([]byte, error)

FixturesMultipleList fetches all fixtures with IDs contained in the supplied comma-separated int string

func Get

func Get(endpoint string, include string, page int, allPages bool) ([]byte, error)

Get API request

func Head2Head

func Head2Head(team1ID, team2ID int, include string) ([]byte, error)

Head2Head fetches all fixtures involving two teams

func IntSliceToSepString

func IntSliceToSepString(slice []int, sep string) string

IntSliceToSepString takes a int slice and generates a string of values separated by specified separator

func League

func League(ID int, include string) ([]byte, error)

League request for specific league identified by ID

func Leagues

func Leagues(include string, page int, allPages bool) ([]byte, error)

Leagues request for all leagues

func LiveStandingsSeason

func LiveStandingsSeason(ID int, include string) ([]byte, error)

LiveStandingsSeason fetches live standings for the specified season

func Livescores

func Livescores(include string, page int, allPages bool) ([]byte, error)

Livescores fetches fixtures which are played today

func LivescoresNow

func LivescoresNow(include string) ([]byte, error)

LivescoresNow fetches live fixtures

func Market

func Market(ID int) ([]byte, error)

Market fetches a market specified by ID

func Markets

func Markets() ([]byte, error)

Markets fetches all markets

func OddsFixture

func OddsFixture(ID int) ([]byte, error)

OddsFixture fetches betting odds for specified fixture

func OddsFixtureBookmaker

func OddsFixtureBookmaker(fixtureID, bookmakerID int) ([]byte, error)

OddsFixtureBookmaker fetches betting information for specified fixture for specified bookmaker

func OddsFixtureMarket

func OddsFixtureMarket(fixtureID, marketID int) ([]byte, error)

OddsFixtureMarket fetches betting odds for specified fixture for specified market

func OddsInPlayFixture

func OddsInPlayFixture(ID int) ([]byte, error)

OddsInPlayFixture fetches in play odds for specified fixture

func Player

func Player(ID int, include string) ([]byte, error)

Player fetches a player specified by ID

func Round

func Round(ID int, include string) ([]byte, error)

Round fetches round specified by ID

func Season

func Season(ID int, include string) ([]byte, error)

Season request for specific season identified by ID

func SeasonRounds

func SeasonRounds(ID int, include string) ([]byte, error)

SeasonRounds fetches all rounds for specified season

func SeasonTeamSquad

func SeasonTeamSquad(seasonID, teamID int, include string) ([]byte, error)

SeasonTeamSquad fetches a squad for a specified team for a specified season

func SeasonTeams

func SeasonTeams(ID int, include string) ([]byte, error)

SeasonTeams fetches all teams from a specified season

func SeasonTopScorer

func SeasonTopScorer(ID int, include string) ([]byte, error)

SeasonTopScorer fetches the top goal scorers for a specified season

func SeasonVenues

func SeasonVenues(ID int) ([]byte, error)

SeasonVenues fetches venues for specified season

func Seasons

func Seasons(include string, page int, allPages bool) ([]byte, error)

Seasons request for all seasons

func SetAPIToken

func SetAPIToken(s string)

SetAPIToken sets the API token for sportmonks

func Stage

func Stage(ID int, include string) ([]byte, error)

Stage fetches stage identified by ID

func StagesSeason

func StagesSeason(ID int, include string) ([]byte, error)

StagesSeason fetches all stages for season specified by ID

func StandingsSeason

func StandingsSeason(ID int, include string) ([]byte, error)

StandingsSeason fetches standings for the specified season

func Team

func Team(ID int, include string) ([]byte, error)

Team fetches a team identified by specified ID

func TvStationsFixture

func TvStationsFixture(ID int) ([]byte, error)

TvStationsFixture fetches all Tv stations which broadcast the specified fixture

func Venue

func Venue(ID int) ([]byte, error)

Venue fetches a venue specified by ID

func VideoHighlights

func VideoHighlights(include string, page int, allPages bool) ([]byte, error)

VideoHighlights fetches links to videos posted on social media (Community feature)

Types

This section is empty.

Jump to

Keyboard shortcuts

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