32 lines
554 B
Go
32 lines
554 B
Go
package e621
|
|
|
|
import (
|
|
"e621_to_neo4j/utils"
|
|
"golang.org/x/time/rate"
|
|
"net/http"
|
|
)
|
|
|
|
const (
|
|
baseURL = "https://e621.net"
|
|
)
|
|
|
|
// Client represents the e621 API client.
|
|
type Client struct {
|
|
apiKey string
|
|
username string
|
|
client *http.Client
|
|
limiter *rate.Limiter
|
|
queue *utils.Queue
|
|
}
|
|
|
|
// NewClient creates a new e621 API client.
|
|
func NewClient(apiKey string, username string) *Client {
|
|
return &Client{
|
|
apiKey: apiKey,
|
|
username: username,
|
|
client: &http.Client{},
|
|
limiter: rate.NewLimiter(1, 2),
|
|
queue: &utils.Queue{},
|
|
}
|
|
}
|