The Central Go Modules Repository

To use GoCenter:
export GOPROXY=https://gocenter.io
0
Stars
UNKNOWN
License
4
Downloads
January 1st 0001
Last Modified
Version:
Loading...

Tinbu XML Lottery feed client

Godoc

This is a go library for accessing Tinbu XML Lottery feed.

Usage example (full state):

package main

import (
        "context"
        "fmt"

        "bitbucket.org/advbet/tinbu"
)

func main() {
        c := tinbu.Client{
                URL: "http://example.net/lotterydata/lottery.xml",
        }

        games, err := c.Load(context.TODO())
        fmt.Println(games, err)
}

Usage example (update stream):

package main

import (
        "context"
        "fmt"
        "net/http"
        "time"

        "bitbucket.org/advbet/tinbu"
)

func main() {
        c := tinbu.Client{
                URL: "http://example.net/lotterydata/lottery.xml",
                HTTPClient: http.Client{
                        Timeout: 10 * time.Second,
                },
        }

        stream := c.StreamUpdates(context.TODO(), time.Minute)
        for msg := range stream {
                if msg.Error != nil {
                        fmt.Println(msg.Error)
                        continue
                }
                fmt.Println(msg.Game)
        }
}