We are able to create directories, upload files and list directory contents using this
How do we download a file from the drive? What should be done after executing the FilesResource_GetMethod ?
1) Is the file already downloaded and available as JsonData after executing FilesResource_GetMethod ? If so should we connect it to a DataWriter to write into a file ?
2) OR if we need to further query the "download url" of the file then how is that done?
Any assistance is greatly appreciated in this regard.
Here is the code we are using that lists all files from a directory.
--
std::unique_ptr<google_drive_api::File> filePtr(google_drive_api::File::New());
const DriveService* _service_ = service_.get();
ChildrenResource_ListMethod listFiles( _service_, &credential_, <file_id_of_dir>);
ChildList* dataList = ChildList::New();
status = listFiles.ExecuteAndParseResponse(dataList);
const client::JsonCppArray<ChildReference> chRef1 = dataList->get_items();
for( int ii=0; ii<chRef1.size(); ii++ ) {
const StringPiece &fileId = chRef1[ii].get_id();
FilesResource_GetMethod *fileGetPtr =
_service_->get_files().NewGetMethod( &credential_, fileId);
google_drive_api::File *filePtr = google_drive_api::File::New();
googleapis::util::Status status = fileGetPtr->ExecuteAndParseResponse(filePtr);
if(status.ok())
std::cout<<filePtr->get_title()<<" : ("<<fileId<<")"<<std::endl;
}
string filePath("/home/admin/temp/");
googleapis::client::DataWriter *dataPtr = googleapis::client::NewFileDataWriter(filePath);
--