read all elements
parent
9ccb5101ec
commit
2debac3055
|
@ -111,7 +111,7 @@ func (c *Client) GetAccountFollowers(ctx context.Context, id int64) ([]*Account,
|
||||||
if !next {
|
if !next {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
time.Sleep(10 * time.Second)
|
time.Sleep(c.interval)
|
||||||
}
|
}
|
||||||
return total, nil
|
return total, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ import (
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Config is a setting for access mastodon APIs.
|
// Config is a setting for access mastodon APIs.
|
||||||
|
@ -26,7 +27,8 @@ type Config struct {
|
||||||
// Client is a API client for mastodon.
|
// Client is a API client for mastodon.
|
||||||
type Client struct {
|
type Client struct {
|
||||||
http.Client
|
http.Client
|
||||||
config *Config
|
config *Config
|
||||||
|
interval time.Duration
|
||||||
}
|
}
|
||||||
|
|
||||||
type page struct {
|
type page struct {
|
||||||
|
@ -133,8 +135,9 @@ func (c *Client) doAPI(ctx context.Context, method string, uri string, params in
|
||||||
// NewClient return new mastodon API client.
|
// NewClient return new mastodon API client.
|
||||||
func NewClient(config *Config) *Client {
|
func NewClient(config *Config) *Client {
|
||||||
return &Client{
|
return &Client{
|
||||||
Client: *http.DefaultClient,
|
Client: *http.DefaultClient,
|
||||||
config: config,
|
config: config,
|
||||||
|
interval: 10 * time.Second,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue