googs is a Go package implements REST and Realtime APIs of OGS
(online-go.com).
The package allows users to authenticate, connect to games, receive game events, and submit moves as a player or watch as an observer.
First request an OGS application,
with Authorization grant type set to Resource owner password-based, keep
note of the client ID and unhashed client secret. Note empty client secret
must be used if the Client type is Public.
client:=googs.NewClient(clientID, clientSecret)
err:=client.Login(username, password)
// if err != nil { ... }client.Save(secretFile)
// Use REST APIoverview, err:=client.Overview())
// if err != nil { ... }fmt.Printf("Total %d active games\n", len(overview.ActiveGames))
// Use Realtime APIclient.GameConnect(12345)
client.OnGameData(gameID, func(g*googs.Game) {
fmt.Printf("Received game data %s\n", g)
})client, err:=googs.LoadClient(secretFile)
// if err != nil { ... }// Websocket is connected, ready to use the APIsSee example usages in demo/ which is a working minimal OGS client program
that you can use to watch and play games on OGS.
And check out ymattw/tenuki for a full OGS client application!
