"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
onedrive: factor API types back into correct file
Nick Craig-Woodecb09badba39
diff --git a/backend/onedrive/api/types.go b/backend/onedrive/api/types.goindex 469fd7502..5649c9ff7 100644--- a/backend/onedrive/api/types.go+++ b/backend/onedrive/api/types.go@@ -185,8 +185,8 @@ type Item struct {Deleted *DeletedFacet `json:"deleted"` // Information about the deleted state of the item. Read-only.}-// ViewDeltaResponse is the response to the view delta method-type ViewDeltaResponse struct {+// DeltaResponse is the response to the view delta method+type DeltaResponse struct {Value []Item `json:"value"` // An array of Item objects which have been created, modified, or deleted.NextLink string `json:"@odata.nextLink"` // A URL to retrieve the next available page of changes.DeltaLink string `json:"@odata.deltaLink"` // A URL returned instead of @odata.nextLink after all current changes have been returned. Used to read the next set of changes in the future.@@ -438,3 +438,27 @@ type Version struct {type VersionsResponse struct {Versions []Version `json:"value"`}++// DriveResource is returned from /me/drive+type DriveResource struct {+ DriveID string `json:"id"`+ DriveName string `json:"name"`+ DriveType string `json:"driveType"`+}++// DrivesResponse is returned from /sites/{siteID}/drives",+type DrivesResponse struct {+ Drives []DriveResource `json:"value"`+}++// SiteResource is part of the response from from "/sites/root:"+type SiteResource struct {+ SiteID string `json:"id"`+ SiteName string `json:"displayName"`+ SiteURL string `json:"webUrl"`+}++// SiteResponse is returned from "/sites/root:"+type SiteResponse struct {+ Sites []SiteResource `json:"value"`+}diff --git a/backend/onedrive/onedrive.go b/backend/onedrive/onedrive.goindex e793f0111..101295371 100644--- a/backend/onedrive/onedrive.go+++ b/backend/onedrive/onedrive.go@@ -371,28 +371,6 @@ file.})}-type driveResource struct {- DriveID string `json:"id"`- DriveName string `json:"name"`- DriveType string `json:"driveType"`-}-type drivesResponse struct {- Drives []driveResource `json:"value"`-}--type siteResource struct {- SiteID string `json:"id"`- SiteName string `json:"displayName"`- SiteURL string `json:"webUrl"`-}-type siteResponse struct {- Sites []siteResource `json:"value"`-}-type deltaResponse struct {- DeltaLink string `json:"@odata.deltaLink"`- Value []api.Item `json:"value"`-}-// Get the region and graphURL from the configfunc getRegionURL(m configmap.Mapper) (region, graphURL string) {region, _ = m.Get("region")@@ -419,7 +397,7 @@ func chooseDrive(ctx context.Context, name string, m configmap.Mapper, srv *restRootURL: graphURL,Path: "/sites/root:" + opt.relativePath,}- site := siteResource{}+ site := api.SiteResource{}_, err := srv.CallJSON(ctx, &opt.opts, nil, &site)if err != nil {return fs.ConfigError("choose_type", fmt.Sprintf("Failed to query available site by relative path: %v", err))@@ -436,7 +414,7 @@ func chooseDrive(ctx context.Context, name string, m configmap.Mapper, srv *rest}}- drives := drivesResponse{}+ drives := api.DrivesResponse{}// We don't have the final ID yet?// query Microsoft Graph@@ -449,7 +427,7 @@ func chooseDrive(ctx context.Context, name string, m configmap.Mapper, srv *rest// Also call /me/drive as sometimes /me/drives doesn't return it #4068if opt.opts.Path == "/me/drives" {opt.opts.Path = "/me/drive"- meDrive := driveResource{}+ meDrive := api.DriveResource{}_, err := srv.CallJSON(ctx, &opt.opts, nil, &meDrive)if err != nil {return fs.ConfigError("choose_type", fmt.Sprintf("Failed to query available drives: %v", err))@@ -468,7 +446,7 @@ func chooseDrive(ctx context.Context, name string, m configmap.Mapper, srv *rest}}} else {- drives.Drives = append(drives.Drives, driveResource{+ drives.Drives = append(drives.Drives, api.DriveResource{DriveID: opt.finalDriveID,DriveName: "Chosen Drive ID",DriveType: "drive",@@ -605,7 +583,7 @@ Examples:Path: "/sites?search=" + searchTerm,}- sites := siteResponse{}+ sites := api.SiteResponse{}_, err := srv.CallJSON(ctx, &opts, nil, &sites)if err != nil {return fs.ConfigError("choose_type", fmt.Sprintf("Failed to query available sites: %v", err))@@ -2481,7 +2459,7 @@ func (f *Fs) changeNotifyStartPageToken(ctx context.Context) (nextDeltaToken strreturn}-func (f *Fs) changeNotifyNextChange(ctx context.Context, token string) (delta deltaResponse, err error) {+func (f *Fs) changeNotifyNextChange(ctx context.Context, token string) (delta api.DeltaResponse, err error) {opts := f.buildDriveDeltaOpts(token)_, err = f.srv.CallJSON(ctx, &opts, nil, &delta)