Skip to content

sgt-kabukiman/srapi

Repository files navigation

speedrun.com API Client for Go

GoDoc

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.

Installation

go get github.com/sgt-kabukiman/srapi

Usage

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
	})
}

License

This code is licensed under the MIT license.

About

API client for speedrun.com in Go

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published