Here's an example of how to use Google Drive query parameters with Flysystem:
use League\Flysystem\Filesystem;
use Hypweb\Flysystem\GoogleDrive\GoogleDriveAdapter;
$client = new \Google_Client();
$client->setClientId('your_client_id');
$client->setClientSecret('your_client_secret');
$client->setRedirectUri('your_redirect_uri');
$client->setAccessType('offline');
$client->setApprovalPrompt('force');
$service = new \Google_Service_Drive($client);
$adapter = new GoogleDriveAdapter($service, 'root');
$filesystem = new Filesystem($adapter);
// Accessing a folder 'Shared With Me'
$sharedWithMeFolderId = 'root';
$parameters = [
'q' => 'sharedWithMe=true and mimeType="application/vnd.google-apps.folder"',
];
$files = $service->files->listFiles($parameters);
foreach ($files->getFiles() as $file) {
if ($file->getName() === 'Shared With Me') {
$sharedWithMeFolderId = $file->getId();
break;
}
}
$adapter = new GoogleDriveAdapter($service, $sharedWithMeFolderId);
$filesystem = new Filesystem($adapter);
This code sets up a Google Drive client and service, creates a Flysystem adapter using the Google Drive adapter, and then uses the Google Drive API to find the ID of the 'Shared With Me' folder. Finally, it creates a new adapter and filesystem using the ID of the 'Shared With Me' folder.
Note that you'll need to replace 'your_client_id', 'your_client_secret', and 'your_redirect_uri' with your own values. You'll also need to install the 'hypweb/flysystem-google-drive' package via Composer.