Compare commits
2 Commits
e01d9805c6
...
v0.0.4
| Author | SHA1 | Date | |
|---|---|---|---|
| dab30b4938 | |||
| 4be44c4eb2 |
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
pb "github/bestnite/go-igdb/proto"
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
pb "github/bestnite/go-igdb/proto"
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
pb "github/bestnite/go-igdb/proto"
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
pb "github/bestnite/go-igdb/proto"
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
pb "github/bestnite/go-igdb/proto"
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,11 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
pb "github/bestnite/go-igdb/proto"
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
pb "github/bestnite/go-igdb/proto"
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
2
games.go
2
games.go
@@ -4,7 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
pb "github/bestnite/go-igdb/proto"
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
2
go.mod
2
go.mod
@@ -1,4 +1,4 @@
|
|||||||
module github/bestnite/go-igdb
|
module github.com/bestnite/go-igdb
|
||||||
|
|
||||||
go 1.24.1
|
go 1.24.1
|
||||||
|
|
||||||
|
|||||||
5
igdb.go
5
igdb.go
@@ -11,11 +11,13 @@ type igdb struct {
|
|||||||
clientID string
|
clientID string
|
||||||
token *twitchToken
|
token *twitchToken
|
||||||
flaresolverr *flaresolverr.Flaresolverr
|
flaresolverr *flaresolverr.Flaresolverr
|
||||||
|
limiter *rateLimiter
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(clientID, clientSecret string) *igdb {
|
func New(clientID, clientSecret string) *igdb {
|
||||||
return &igdb{
|
return &igdb{
|
||||||
clientID: clientID,
|
clientID: clientID,
|
||||||
|
limiter: newRateLimiter(4),
|
||||||
token: NewTwitchToken(clientID, clientSecret),
|
token: NewTwitchToken(clientID, clientSecret),
|
||||||
flaresolverr: nil,
|
flaresolverr: nil,
|
||||||
}
|
}
|
||||||
@@ -24,12 +26,15 @@ func New(clientID, clientSecret string) *igdb {
|
|||||||
func NewWithFlaresolverr(clientID, clientSecret string, f *flaresolverr.Flaresolverr) *igdb {
|
func NewWithFlaresolverr(clientID, clientSecret string, f *flaresolverr.Flaresolverr) *igdb {
|
||||||
return &igdb{
|
return &igdb{
|
||||||
clientID: clientID,
|
clientID: clientID,
|
||||||
|
limiter: newRateLimiter(4),
|
||||||
token: NewTwitchToken(clientID, clientSecret),
|
token: NewTwitchToken(clientID, clientSecret),
|
||||||
flaresolverr: f,
|
flaresolverr: f,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *igdb) Request(URL string, dataBody any) (*resty.Response, error) {
|
func (g *igdb) Request(URL string, dataBody any) (*resty.Response, error) {
|
||||||
|
g.limiter.wait()
|
||||||
|
|
||||||
t, err := g.token.getToken()
|
t, err := g.token.getToken()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to get twitch token: %w", err)
|
return nil, fmt.Errorf("failed to get twitch token: %w", err)
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
pb "github/bestnite/go-igdb/proto"
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
48
rate_limiter.go
Normal file
48
rate_limiter.go
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
package igdb
|
||||||
|
|
||||||
|
import (
|
||||||
|
"sync"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
type rateLimiter struct {
|
||||||
|
mu sync.Mutex
|
||||||
|
rate int
|
||||||
|
interval time.Duration
|
||||||
|
tokens int
|
||||||
|
lastRefill time.Time
|
||||||
|
}
|
||||||
|
|
||||||
|
func newRateLimiter(rate int) *rateLimiter {
|
||||||
|
return &rateLimiter{
|
||||||
|
rate: rate,
|
||||||
|
interval: time.Second,
|
||||||
|
tokens: rate,
|
||||||
|
lastRefill: time.Now(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *rateLimiter) wait() {
|
||||||
|
r.mu.Lock()
|
||||||
|
defer r.mu.Unlock()
|
||||||
|
|
||||||
|
now := time.Now()
|
||||||
|
elapsed := now.Sub(r.lastRefill)
|
||||||
|
|
||||||
|
if elapsed >= r.interval {
|
||||||
|
r.tokens = r.rate
|
||||||
|
r.lastRefill = now
|
||||||
|
}
|
||||||
|
|
||||||
|
if r.tokens <= 0 {
|
||||||
|
waitTime := r.interval - elapsed
|
||||||
|
r.mu.Unlock()
|
||||||
|
time.Sleep(waitTime)
|
||||||
|
r.mu.Lock()
|
||||||
|
r.tokens = r.rate - 1
|
||||||
|
r.lastRefill = time.Now()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
r.tokens--
|
||||||
|
}
|
||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
pb "github/bestnite/go-igdb/proto"
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"github.com/PuerkitoBio/goquery"
|
"github.com/PuerkitoBio/goquery"
|
||||||
"github.com/bestnite/go-flaresolverr"
|
"github.com/bestnite/go-flaresolverr"
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
|
||||||
"github/bestnite/go-igdb/endpoint"
|
"github.com/bestnite/go-igdb/endpoint"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (g *igdb) ActiveWebhook(endpoint endpoint.Endpoint, secret, callbackUrl string) error {
|
func (g *igdb) ActiveWebhook(endpoint endpoint.Endpoint, secret, callbackUrl string) error {
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ package igdb
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pb "github/bestnite/go-igdb/proto"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
pb "github.com/bestnite/go-igdb/proto"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user