Google Drive Files

Figure 1a. Instantiate Google Drive Files
$files = eden('google')->drive($_SESSION['token'])->files();
Figure 2. Usage: Upload a file.

$data = $_FILES['data']['tmp_name']; $fileId = $files->create('filename.jpg', 'image/jpeg', $data);
Figure 3. Files Methods
Method Arguments Returns Description
$files->copyFile($fileId);
  1. string
array Creates a copy of the specified file
$files->create($title, $mimeType, $data);
  1. string
  2. - The title of the this file, must put exact extension name, ex. filename.pdf
array - The MIME type of the file. ex. application/pdf, image/jpeg This method supports media upload. Uploaded files must conform to these constraints:
$files->delete($fileId);
  1. string
array Updates file metadata and/or content.
$files->getList(); none array Returns the color definitions for calendars and events.
$files->getSpecific($fileId);
  1. string
array Gets a file's metadata by ID.
$files->patch($fileId); none array Updates file metadata and/or content. This method supports patch semantics.
$files->setDescription($description);
  1. string
Eden_Google_Drive_Files A short description of the file.
$files->setMimeType($mimeType);
  1. string
Eden_Google_Drive_Files The MIME type of the file.
$files->setLastViewedDate($lastViewedDate);
  1. string|int
Eden_Google_Drive_Files Last time this file was viewed by the user (formatted RFC 3339 timestamp).
$files->setModifiedDate($modifiedDate);
  1. string|int
Eden_Google_Drive_Files Last time this file was modified by anyone (formatted RFC 3339 timestamp). This is only mutable on update when the setModifiedDate parameter is set.
$files->setOcrLanguage($ocrLanguage);
  1. string
Eden_Google_Drive_Files If ocr is true, hints at the language to use. Valid values are ISO 639-1 codes.
$files->setSourceLanguage($sourceLanguage);
  1. string
Eden_Google_Drive_Files The language of the original file to be translated.
$files->setTargetLanguage($targetLanguage);
  1. string
Eden_Google_Drive_Files Target language to translate the file to. If no sourceLanguage is provided, the API will attempt to detect the language.
$files->setTimedTextLanguage($timedTextLanguage);
  1. string
Eden_Google_Drive_Files The language of the timed text.
$files->setTimedTextTrackName($timedTextTrackName);
  1. string
Eden_Google_Drive_Files The timed text track name.
$files->setTitle($title);
  1. string
Eden_Google_Drive_Files The title of the this file. Used to identify file or folder name.
$files->convert(); none Eden_Google_Drive_Files Whether to convert this file to the corresponding Google Docs format.
$files->setToNewRevision(); none Eden_Google_Drive_Files Whether a blob upload should create a new revision. If false, the blob data in the current head revision will be replaced.
$files->setToOcr(); none Eden_Google_Drive_Files Whether to attempt OCR on .jpg, .png, or .gif uploads.
$files->setToPinned(); none Eden_Google_Drive_Files Whether to pin the head revision of the uploaded file.
$files->trash($fileId);
  1. string
array Moves a file to the trash.
$files->touchFile($fileId);
  1. string
array Set the file's updated time to the current server time
$files->untrash();
  1. string
array Restores a file from the trash
$files->update($fileId);
  1. string
array Updates file metadata and/or content.
$files->upload($data, $id);
  1. string
  2. - ex. $_FILES['INPUT_NAME']['tmp_name']
  3. string
  4. - File id
array Upload file data

© 2012 Openovate Labs. All rights reserved.