1
0
mirror of https://github.com/rclone/rclone.git synced 2025-12-21 10:43:37 +00:00

vendor: add github.com/putdotio/go-putio for putio client

This commit is contained in:
Cenk Alti
2019-08-06 15:43:14 +03:00
committed by Nick Craig-Wood
parent 8159658e67
commit 566aa0fca7
15 changed files with 1315 additions and 0 deletions

42
vendor/github.com/putdotio/go-putio/putio/account.go generated vendored Normal file
View File

@@ -0,0 +1,42 @@
package putio
import "context"
// AccountService is the service to gather information about user account.
type AccountService struct {
client *Client
}
// Info retrieves user account information.
func (a *AccountService) Info(ctx context.Context) (AccountInfo, error) {
req, err := a.client.NewRequest(ctx, "GET", "/v2/account/info", nil)
if err != nil {
return AccountInfo{}, nil
}
var r struct {
Info AccountInfo
}
_, err = a.client.Do(req, &r)
if err != nil {
return AccountInfo{}, err
}
return r.Info, nil
}
// Settings retrieves user preferences.
func (a *AccountService) Settings(ctx context.Context) (Settings, error) {
req, err := a.client.NewRequest(ctx, "GET", "/v2/account/settings", nil)
if err != nil {
return Settings{}, nil
}
var r struct {
Settings Settings
}
_, err = a.client.Do(req, &r)
if err != nil {
return Settings{}, err
}
return r.Settings, nil
}