remove helper

This commit is contained in:
ns2kracy 2025-02-21 15:41:55 +08:00
parent 4af421a0f4
commit b88b3f181f
No known key found for this signature in database
GPG Key ID: 3E6E5EE4AFFF61DB

View File

@ -1,43 +0,0 @@
package adrive
import (
"context"
"net/http"
"sync"
"github.com/rclone/rclone/fs"
"github.com/rclone/rclone/lib/pacer"
"github.com/rclone/rclone/lib/rest"
)
// Client contains the info for the Aliyun Drive API
type AdriveClient struct {
mu sync.RWMutex // Protecting read/writes
c *rest.Client // The REST client
rootURL string // API root URL
driveID string // Drive ID
errorHandler func(resp *http.Response) error
pacer *fs.Pacer // To pace the API calls
}
// NewClient takes an http.Client and makes a new api instance
func NewAdriveClient(c *http.Client, rootURL string) *AdriveClient {
client := &AdriveClient{
c: rest.NewClient(c),
rootURL: rootURL,
}
client.c.SetErrorHandler(errorHandler)
client.c.SetRoot(rootURL)
// Create a pacer using rclone's default exponential backoff
client.pacer = fs.NewPacer(
context.Background(),
pacer.NewDefault(
pacer.MinSleep(minSleep),
pacer.MaxSleep(maxSleep),
pacer.DecayConstant(decayConstant),
),
)
return client
}