forked from TrueCloudLab/rclone
vendor: add github.com/putdotio/go-putio for putio client
This commit is contained in:
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
42
vendor/github.com/putdotio/go-putio/putio/account.go
generated
vendored
Normal 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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue