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

not possible to access the thumbnail from getThumbnailBatch in swiftydropbox #349

Closed
mammaiap opened this issue Jan 4, 2022 · 3 comments

Comments

@mammaiap
Copy link

mammaiap commented Jan 4, 2022

DropboxClientsManager.authorizedClient?.files.getThumbnailBatch(entries: subList).response(queue: DispatchQueue.global(qos: .default), completionHandler: { (dataResponse, error) in

            if((dataResponse) != nil)

            {

                let results = dataResponse?.entries

                

                //print("getThumbnailBatch dataResponse:",results)

                

                results?.forEach { result in

                    

                    //let descstr = result.description

                    

                   

                    

                }

                

                

            }

            

            

        })

here "result" is GetThumbnailBatchResultEntry ... that is "ENUM" ..

can anyone help me, how to get the "

"thumbnail" and "metadata" from this ..

result.thumbnail and result.metadata throws the compilation error ...

so how i can access the "thumbnail and "metadata"?

@greg-db
Copy link
Contributor

greg-db commented Jan 4, 2022

The GetThumbnailBatchResultEntry type is a union to cover success, failure, and other cases, so you'll need to use a switch to handle each case, like this:

switch result {
    case .success(let data):
        print(data.metadata)
        print(data.thumbnail)
    case .failure(let error):
        print(error)
    case .other:
        print("other result")
}

@greg-db greg-db closed this as completed Jan 4, 2022
@mammaiap
Copy link
Author

mammaiap commented Jan 5, 2022

ok ...i will try it

Thanks

@mammaiap
Copy link
Author

mammaiap commented Jan 5, 2022

Hi greg,
it worked. thanks

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

No branches or pull requests

2 participants