@@ -30,8 +30,10 @@ import (
3030
3131var tr = i18n .Tr
3232
33- // LibraryDownload FIXMEDOC
34- func LibraryDownload (ctx context.Context , req * rpc.LibraryDownloadRequest , downloadCB rpc.DownloadProgressCB ) (* rpc.LibraryDownloadResponse , error ) {
33+ // LibraryDownload executes the download of the library.
34+ // A DownloadProgressCB callback function must be passed to monitor download progress.
35+ // queryParameter is passed for analysis purposes.
36+ func LibraryDownload (ctx context.Context , req * rpc.LibraryDownloadRequest , downloadCB rpc.DownloadProgressCB , queryParameter string ) (* rpc.LibraryDownloadResponse , error ) {
3537 logrus .Info ("Executing `arduino-cli lib download`" )
3638
3739 lm := commands .GetLibraryManager (req )
@@ -46,22 +48,22 @@ func LibraryDownload(ctx context.Context, req *rpc.LibraryDownloadRequest, downl
4648 return nil , err
4749 }
4850
49- if err := downloadLibrary (lm , lib , downloadCB , func (* rpc.TaskProgress ) {}); err != nil {
51+ if err := downloadLibrary (lm , lib , downloadCB , func (* rpc.TaskProgress ) {}, queryParameter ); err != nil {
5052 return nil , err
5153 }
5254
5355 return & rpc.LibraryDownloadResponse {}, nil
5456}
5557
5658func downloadLibrary (lm * librariesmanager.LibrariesManager , libRelease * librariesindex.Release ,
57- downloadCB rpc.DownloadProgressCB , taskCB rpc.TaskProgressCB ) error {
59+ downloadCB rpc.DownloadProgressCB , taskCB rpc.TaskProgressCB , queryParameter string ) error {
5860
5961 taskCB (& rpc.TaskProgress {Name : tr ("Downloading %s" , libRelease )})
6062 config , err := httpclient .GetDownloaderConfig ()
6163 if err != nil {
6264 return & arduino.FailedDownloadError {Message : tr ("Can't download library" ), Cause : err }
6365 }
64- if err := libRelease .Resource .Download (lm .DownloadsDir , config , libRelease .String (), downloadCB ); err != nil {
66+ if err := libRelease .Resource .Download (lm .DownloadsDir , config , libRelease .String (), downloadCB , queryParameter ); err != nil {
6567 return & arduino.FailedDownloadError {Message : tr ("Can't download library" ), Cause : err }
6668 }
6769 taskCB (& rpc.TaskProgress {Completed : true })
0 commit comments