backend: rename variables to fix CI lint test failures
This commit is contained in:
parent
2abeda5961
commit
9c6325c131
5 changed files with 33 additions and 38 deletions
|
@ -428,15 +428,15 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e
|
||||||
members := []*team.UserSelectorArg{&user}
|
members := []*team.UserSelectorArg{&user}
|
||||||
args := team.NewMembersGetInfoArgs(members)
|
args := team.NewMembersGetInfoArgs(members)
|
||||||
|
|
||||||
memberIds, err := f.team.MembersGetInfo(args)
|
memberIDs, err := f.team.MembersGetInfo(args)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("invalid dropbox team member: %q: %w", opt.Impersonate, err)
|
return nil, fmt.Errorf("invalid dropbox team member: %q: %w", opt.Impersonate, err)
|
||||||
}
|
}
|
||||||
if len(memberIds) == 0 || memberIds[0].MemberInfo == nil || memberIds[0].MemberInfo.Profile == nil {
|
if len(memberIDs) == 0 || memberIDs[0].MemberInfo == nil || memberIDs[0].MemberInfo.Profile == nil {
|
||||||
return nil, fmt.Errorf("dropbox team member not found: %q", opt.Impersonate)
|
return nil, fmt.Errorf("dropbox team member not found: %q", opt.Impersonate)
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg.AsMemberID = memberIds[0].MemberInfo.Profile.MemberProfile.TeamMemberId
|
cfg.AsMemberID = memberIDs[0].MemberInfo.Profile.MemberProfile.TeamMemberId
|
||||||
}
|
}
|
||||||
|
|
||||||
f.srv = files.New(cfg)
|
f.srv = files.New(cfg)
|
||||||
|
@ -1231,7 +1231,7 @@ func (f *Fs) About(ctx context.Context) (usage *fs.Usage, err error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
var total uint64
|
var total uint64
|
||||||
var used = q.Used
|
used := q.Used
|
||||||
if q.Allocation != nil {
|
if q.Allocation != nil {
|
||||||
if q.Allocation.Individual != nil {
|
if q.Allocation.Individual != nil {
|
||||||
total += q.Allocation.Individual.Allocated
|
total += q.Allocation.Individual.Allocated
|
||||||
|
|
|
@ -56,8 +56,7 @@ type MediaItem struct {
|
||||||
CreationTime time.Time `json:"creationTime"`
|
CreationTime time.Time `json:"creationTime"`
|
||||||
Width string `json:"width"`
|
Width string `json:"width"`
|
||||||
Height string `json:"height"`
|
Height string `json:"height"`
|
||||||
Photo struct {
|
Photo struct{} `json:"photo"`
|
||||||
} `json:"photo"`
|
|
||||||
} `json:"mediaMetadata"`
|
} `json:"mediaMetadata"`
|
||||||
Filename string `json:"filename"`
|
Filename string `json:"filename"`
|
||||||
}
|
}
|
||||||
|
@ -68,7 +67,7 @@ type MediaItems struct {
|
||||||
NextPageToken string `json:"nextPageToken"`
|
NextPageToken string `json:"nextPageToken"`
|
||||||
}
|
}
|
||||||
|
|
||||||
//Content categories
|
// Content categories
|
||||||
// NONE Default content category. This category is ignored when any other category is used in the filter.
|
// NONE Default content category. This category is ignored when any other category is used in the filter.
|
||||||
// LANDSCAPES Media items containing landscapes.
|
// LANDSCAPES Media items containing landscapes.
|
||||||
// RECEIPTS Media items containing receipts.
|
// RECEIPTS Media items containing receipts.
|
||||||
|
@ -187,5 +186,5 @@ type BatchCreateResponse struct {
|
||||||
|
|
||||||
// BatchRemoveItems is for removing items from an album
|
// BatchRemoveItems is for removing items from an album
|
||||||
type BatchRemoveItems struct {
|
type BatchRemoveItems struct {
|
||||||
MediaItemIds []string `json:"mediaItemIds"`
|
MediaItemIDs []string `json:"mediaItemIds"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -280,7 +280,7 @@ func errorHandler(resp *http.Response) error {
|
||||||
if strings.HasPrefix(resp.Header.Get("Content-Type"), "image/") {
|
if strings.HasPrefix(resp.Header.Get("Content-Type"), "image/") {
|
||||||
body = []byte("Image not found or broken")
|
body = []byte("Image not found or broken")
|
||||||
}
|
}
|
||||||
var e = api.Error{
|
e := api.Error{
|
||||||
Details: api.ErrorDetails{
|
Details: api.ErrorDetails{
|
||||||
Code: resp.StatusCode,
|
Code: resp.StatusCode,
|
||||||
Message: string(body),
|
Message: string(body),
|
||||||
|
@ -702,7 +702,7 @@ func (f *Fs) createAlbum(ctx context.Context, albumTitle string) (album *api.Alb
|
||||||
Path: "/albums",
|
Path: "/albums",
|
||||||
Parameters: url.Values{},
|
Parameters: url.Values{},
|
||||||
}
|
}
|
||||||
var request = api.CreateAlbum{
|
request := api.CreateAlbum{
|
||||||
Album: &api.Album{
|
Album: &api.Album{
|
||||||
Title: albumTitle,
|
Title: albumTitle,
|
||||||
},
|
},
|
||||||
|
@ -1002,7 +1002,7 @@ func (f *Fs) commitBatchAlbumID(ctx context.Context, items []uploadedItem, resul
|
||||||
Method: "POST",
|
Method: "POST",
|
||||||
Path: "/mediaItems:batchCreate",
|
Path: "/mediaItems:batchCreate",
|
||||||
}
|
}
|
||||||
var request = api.BatchCreateRequest{
|
request := api.BatchCreateRequest{
|
||||||
AlbumID: albumID,
|
AlbumID: albumID,
|
||||||
}
|
}
|
||||||
itemsInBatch := 0
|
itemsInBatch := 0
|
||||||
|
@ -1174,8 +1174,8 @@ func (o *Object) Remove(ctx context.Context) (err error) {
|
||||||
Path: "/albums/" + album.ID + ":batchRemoveMediaItems",
|
Path: "/albums/" + album.ID + ":batchRemoveMediaItems",
|
||||||
NoResponse: true,
|
NoResponse: true,
|
||||||
}
|
}
|
||||||
var request = api.BatchRemoveItems{
|
request := api.BatchRemoveItems{
|
||||||
MediaItemIds: []string{o.id},
|
MediaItemIDs: []string{o.id},
|
||||||
}
|
}
|
||||||
var resp *http.Response
|
var resp *http.Response
|
||||||
err = o.fs.pacer.Call(func() (bool, error) {
|
err = o.fs.pacer.Call(func() (bool, error) {
|
||||||
|
|
|
@ -71,12 +71,11 @@ type Error struct {
|
||||||
|
|
||||||
// ErrorDetails contains further details of api error
|
// ErrorDetails contains further details of api error
|
||||||
type ErrorDetails struct {
|
type ErrorDetails struct {
|
||||||
Type string `json:"@type,omitempty"`
|
Type string `json:"@type,omitempty"`
|
||||||
Reason string `json:"reason,omitempty"`
|
Reason string `json:"reason,omitempty"`
|
||||||
Domain string `json:"domain,omitempty"`
|
Domain string `json:"domain,omitempty"`
|
||||||
Metadata struct {
|
Metadata struct{} `json:"metadata,omitempty"` // TODO: undiscovered yet
|
||||||
} `json:"metadata,omitempty"` // TODO: undiscovered yet
|
Locale string `json:"locale,omitempty"` // e.g. "en"
|
||||||
Locale string `json:"locale,omitempty"` // e.g. "en"
|
|
||||||
Message string `json:"message,omitempty"`
|
Message string `json:"message,omitempty"`
|
||||||
StackEntries []interface{} `json:"stack_entries,omitempty"` // TODO: undiscovered yet
|
StackEntries []interface{} `json:"stack_entries,omitempty"` // TODO: undiscovered yet
|
||||||
Detail string `json:"detail,omitempty"`
|
Detail string `json:"detail,omitempty"`
|
||||||
|
@ -266,13 +265,11 @@ type FileApp struct {
|
||||||
NeedMoreQuota bool `json:"need_more_quota,omitempty"`
|
NeedMoreQuota bool `json:"need_more_quota,omitempty"`
|
||||||
IconLink string `json:"icon_link,omitempty"`
|
IconLink string `json:"icon_link,omitempty"`
|
||||||
IsDefault bool `json:"is_default,omitempty"`
|
IsDefault bool `json:"is_default,omitempty"`
|
||||||
Params struct {
|
Params struct{} `json:"params,omitempty"` // TODO
|
||||||
} `json:"params,omitempty"` // TODO
|
CategoryIDs []interface{} `json:"category_ids,omitempty"`
|
||||||
CategoryIds []interface{} `json:"category_ids,omitempty"`
|
AdSceneType int `json:"ad_scene_type,omitempty"`
|
||||||
AdSceneType int `json:"ad_scene_type,omitempty"`
|
Space string `json:"space,omitempty"`
|
||||||
Space string `json:"space,omitempty"`
|
Links struct{} `json:"links,omitempty"` // TODO
|
||||||
Links struct {
|
|
||||||
} `json:"links,omitempty"` // TODO
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------
|
// ------------------------------------------------------------
|
||||||
|
@ -384,11 +381,10 @@ type NewTask struct {
|
||||||
|
|
||||||
// About informs drive status
|
// About informs drive status
|
||||||
type About struct {
|
type About struct {
|
||||||
Kind string `json:"kind,omitempty"` // "drive#about"
|
Kind string `json:"kind,omitempty"` // "drive#about"
|
||||||
Quota *Quota `json:"quota,omitempty"`
|
Quota *Quota `json:"quota,omitempty"`
|
||||||
ExpiresAt string `json:"expires_at,omitempty"`
|
ExpiresAt string `json:"expires_at,omitempty"`
|
||||||
Quotas struct {
|
Quotas struct{} `json:"quotas,omitempty"` // maybe []*Quota?
|
||||||
} `json:"quotas,omitempty"` // maybe []*Quota?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Quota informs drive quota
|
// Quota informs drive quota
|
||||||
|
@ -462,7 +458,7 @@ type DecompressResult struct {
|
||||||
|
|
||||||
// RequestShare is to request for file share
|
// RequestShare is to request for file share
|
||||||
type RequestShare struct {
|
type RequestShare struct {
|
||||||
FileIds []string `json:"file_ids,omitempty"`
|
FileIDs []string `json:"file_ids,omitempty"`
|
||||||
ShareTo string `json:"share_to,omitempty"` // "publiclink",
|
ShareTo string `json:"share_to,omitempty"` // "publiclink",
|
||||||
ExpirationDays int `json:"expiration_days,omitempty"` // -1 = 'forever'
|
ExpirationDays int `json:"expiration_days,omitempty"` // -1 = 'forever'
|
||||||
PassCodeOption string `json:"pass_code_option,omitempty"` // "NOT_REQUIRED"
|
PassCodeOption string `json:"pass_code_option,omitempty"` // "NOT_REQUIRED"
|
||||||
|
@ -470,7 +466,7 @@ type RequestShare struct {
|
||||||
|
|
||||||
// RequestBatch is to request for batch actions
|
// RequestBatch is to request for batch actions
|
||||||
type RequestBatch struct {
|
type RequestBatch struct {
|
||||||
Ids []string `json:"ids,omitempty"`
|
IDs []string `json:"ids,omitempty"`
|
||||||
To map[string]string `json:"to,omitempty"`
|
To map[string]string `json:"to,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -775,7 +775,7 @@ func (f *Fs) PublicLink(ctx context.Context, remote string, expire fs.Duration,
|
||||||
expiry = int(math.Ceil(time.Duration(expire).Hours() / 24))
|
expiry = int(math.Ceil(time.Duration(expire).Hours() / 24))
|
||||||
}
|
}
|
||||||
req := api.RequestShare{
|
req := api.RequestShare{
|
||||||
FileIds: []string{id},
|
FileIDs: []string{id},
|
||||||
ShareTo: "publiclink",
|
ShareTo: "publiclink",
|
||||||
ExpirationDays: expiry,
|
ExpirationDays: expiry,
|
||||||
PassCodeOption: "NOT_REQUIRED",
|
PassCodeOption: "NOT_REQUIRED",
|
||||||
|
@ -797,7 +797,7 @@ func (f *Fs) deleteObjects(ctx context.Context, IDs []string, useTrash bool) (er
|
||||||
action = "batchTrash"
|
action = "batchTrash"
|
||||||
}
|
}
|
||||||
req := api.RequestBatch{
|
req := api.RequestBatch{
|
||||||
Ids: IDs,
|
IDs: IDs,
|
||||||
}
|
}
|
||||||
if err := f.requestBatchAction(ctx, action, &req); err != nil {
|
if err := f.requestBatchAction(ctx, action, &req); err != nil {
|
||||||
return fmt.Errorf("delete object failed: %w", err)
|
return fmt.Errorf("delete object failed: %w", err)
|
||||||
|
@ -817,7 +817,7 @@ func (f *Fs) purgeCheck(ctx context.Context, dir string, check bool) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
var trashedFiles = false
|
trashedFiles := false
|
||||||
if check {
|
if check {
|
||||||
found, err := f.listAll(ctx, rootID, "", "", func(item *api.File) bool {
|
found, err := f.listAll(ctx, rootID, "", "", func(item *api.File) bool {
|
||||||
if !item.Trashed {
|
if !item.Trashed {
|
||||||
|
@ -893,7 +893,7 @@ func (f *Fs) moveObjects(ctx context.Context, IDs []string, dirID string) (err e
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
req := api.RequestBatch{
|
req := api.RequestBatch{
|
||||||
Ids: IDs,
|
IDs: IDs,
|
||||||
To: map[string]string{"parent_id": parentIDForRequest(dirID)},
|
To: map[string]string{"parent_id": parentIDForRequest(dirID)},
|
||||||
}
|
}
|
||||||
if err := f.requestBatchAction(ctx, "batchMove", &req); err != nil {
|
if err := f.requestBatchAction(ctx, "batchMove", &req); err != nil {
|
||||||
|
@ -1039,7 +1039,7 @@ func (f *Fs) copyObjects(ctx context.Context, IDs []string, dirID string) (err e
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
req := api.RequestBatch{
|
req := api.RequestBatch{
|
||||||
Ids: IDs,
|
IDs: IDs,
|
||||||
To: map[string]string{"parent_id": parentIDForRequest(dirID)},
|
To: map[string]string{"parent_id": parentIDForRequest(dirID)},
|
||||||
}
|
}
|
||||||
if err := f.requestBatchAction(ctx, "batchCopy", &req); err != nil {
|
if err := f.requestBatchAction(ctx, "batchCopy", &req); err != nil {
|
||||||
|
|
Loading…
Reference in a new issue