Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Which utils from utils.FileInfo is it referring to in the README? #867

Open
andy8leung opened this issue Dec 8, 2023 · 1 comment
Open
Labels
question Further information is requested

Comments

@andy8leung
Copy link

I'm trying to get the upload/download summary and I see an example in the readme. Which utils module is it coming from? There's a number in this project and I can't seem to find FileInfo in any of them.

for currentFileInfo := new(utils.FileInfo); reader.NextRecord(currentFileInfo) == nil; currentFileInfo = new(utils.FileInfo) {
     fmt.Printf("File path: %s\n", currentFileInfo.LocalPath)
}
@andy8leung andy8leung added the question Further information is requested label Dec 8, 2023
@a-yee
Copy link

a-yee commented Dec 26, 2023

Hey Andy, it looks like they changed the function names and combined the return values into a new struct in #299. I think the README example should reference the following util pkgs:

import (
  sutils "github.com/jfrog/jfrog-client-go/artifactory/services/utils"
  "github.com/jfrog/jfrog-client-go/utils"
)
...

// Download files with summary example
params := services.NewDownloadParams()
params.Pattern = "repo/*/*.zip"
params.Target = "repo/path/"

summary, err := rtManager.DownloadFilesWithSummary(params)
defer summary.Close()

// Iterate over each file's ArtifactDetails
// ArtifactDetails comes from: github.com/jfrog/jfrog-client-go/artifactory/services/utils
adNext := summary.ArtifactsDetailsReader.NextRecord
for ad := new(sutils.ArtifactDetails); adNext(ad) == nil; ad = new(sutils.ArtifactDetails) {
     fmt.Printf("ArtifactDetails: %+v\n", ad)
}

if err := summary.ArtifactsDetailsReader.GetError(); err != nil {
    return err
}

// Iterate over each file's TransferDetails
// FileTransferDetails comes from: github.com/jfrog/jfrog-client-go/utils
tdNext := summary.TransferDetailsReader.NextRecord
for td := new(utils.FileTransferDetails); tdNext(td) == nil; td = new(utils.FileTransferDetails) {
     fmt.Printf("FileTransferDetails: %+v\n", td)
}

if err := summary.TransferDetailsReader.GetError(); err != nil {
    return err
}
  • I think it works the same way for summaries returned from rtManager.UploadFilesWithSummary(params)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants