This Go package implements a client for the
speedrun.com API. It's not 100% complete
and a relatively direct mapping of API structures to Go struct
values.
go get github.com/sgt-kabukiman/srapi
package main
import (
"fmt"
"github.com/sgt-kabukiman/srapi"
)
func main() {
// optional sorting
sort := &srapi.Sorting{"name", srapi.Descending}
// optional pagination
cursor := &srapi.Cursor{2, 2} // offset, max
// optional embeds
embeds := srapi.NoEmbeds
regions, err := srapi.Regions(sort, cursor, embeds)
if err != nil {
panic(err) // err is an srapi.*ApiError struct, containing more information
}
regions.Walk(func(r *Region) bool {
fmt.Printf("Region = %s\n", r.Name)
return true // false to skip walking
})
}
This code is licensed under the MIT license.