github.com/Files-com/files-sdk-go/v2@v2.1.2/file/jobparams.go (about)

     1  package file
     2  
     3  import (
     4  	"io/fs"
     5  
     6  	"github.com/Files-com/files-sdk-go/v2/file/status"
     7  	"github.com/Files-com/files-sdk-go/v2/lib/direction"
     8  	"github.com/hashicorp/go-retryablehttp"
     9  )
    10  
    11  func SetJobParams(r *status.Job, d direction.Direction, params interface{}, logger retryablehttp.Logger, remoteFs fs.FS) {
    12  	r.Params = params
    13  	r.Direction = d
    14  	r.Logger = logger
    15  	r.RemoteFs = remoteFs
    16  	switch d {
    17  	case direction.DownloadType:
    18  		p := params.(DownloaderParams)
    19  		r.SetManager(p.Manager)
    20  		r.SetEventsReporter(p.EventsReporter)
    21  		r.RetryPolicy = p.RetryPolicy
    22  		r.LocalPath = p.LocalPath
    23  		r.RemotePath = p.RemotePath
    24  		r.Sync = p.Sync
    25  	case direction.UploadType:
    26  		p := params.(UploaderParams)
    27  		r.SetManager(p.Manager)
    28  		r.SetEventsReporter(p.EventsReporter)
    29  		r.RetryPolicy = p.RetryPolicy
    30  		r.LocalPath = p.LocalPath
    31  		r.RemotePath = p.RemotePath
    32  		r.Sync = p.Sync
    33  	}
    34  
    35  }