Go wrapper for SportMonks Soccer API https://www.sportmonks.com/
Switch branches/tags
Nothing to show
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Initial commit May 1, 2018
.travis.yml Add .travis.yml and Makefile Aug 25, 2018
LICENSE.md Initial commit May 1, 2018
Makefile Add .travis.yml and Makefile Aug 25, 2018
README.md Update README Aug 25, 2018
sportmonks.go Add tests and fix typo Aug 25, 2018
sportmonks_test.go Add tests and fix typo Aug 25, 2018
utilities.go Move unrelated helper functions to utilities file Aug 25, 2018
utilities_test.go Add tests and fix typo Aug 25, 2018

README.md

Build Status Go Report Card License

golang-sportmonks

Golang wrapper for the Sportmonks Soccer API

Pull requests are welcome!

Installation

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

Usage

package main

import (
	"fmt"
	"log"

	sm "github.com/BialkowskiSz/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...