This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
e621-sdk-go/e621/client.go

32 lines
554 B
Go
Raw Normal View History

2023-05-24 14:05:27 +00:00
package e621
2023-05-22 11:08:08 +00:00
import (
"e621_to_neo4j/utils"
2023-06-17 19:18:01 +00:00
"golang.org/x/time/rate"
2023-05-22 11:08:08 +00:00
"net/http"
)
const (
baseURL = "https://e621.net"
)
// Client represents the e621 API client.
type Client struct {
apiKey string
username string
client *http.Client
2023-06-17 19:18:01 +00:00
limiter *rate.Limiter
queue *utils.Queue
2023-05-22 11:08:08 +00:00
}
// NewClient creates a new e621 API client.
func NewClient(apiKey string, username string) *Client {
return &Client{
apiKey: apiKey,
username: username,
client: &http.Client{},
2023-06-17 19:18:01 +00:00
limiter: rate.NewLimiter(1, 2),
queue: &utils.Queue{},
2023-05-22 11:08:08 +00:00
}
}