\QGoogleFile

This class allows working with files on Google Drive

Summary

Methods
Properties
Constants
__construct()
__get()
deleteFile()
trashFile()
untrashFile()
shareFile()
retrievePermissions()
noShareFile()
downloadFile()
copyFile()
renameFile()
$permission
$file
$client
$service
$error
$errorGoogle
No constants found
No protected methods found
$client
$service
$error
$errorGoogle
$permission
$file
N/A
No private methods found
No private properties found
N/A

Properties

$permission

$permission : \Google_Permission

contains Google permission from specific file

Type

\Google_Permission

$file

$file : \Google_DriveFile

contains Google file from Google Drive

Type

\Google_DriveFile

$client

$client : \Google_Client

contains Google Client

Type

\Google_Client

$service

$service : \Google_DriveService

contains Google Drive Service API to interact with Drive

Type

\Google_DriveService

$error

$error : string

contains error message

Type

string

$errorGoogle

$errorGoogle : string

contains error message from Google_Exception

Type

string

$client

$client : \Google_Client

Type

\Google_Client — Google Client API

$service

$service : \Google_DriveService

Type

\Google_DriveService — Google Drive Service API to interact with Drive

$error

$error : string

Type

string — Error message

$errorGoogle

$errorGoogle : string

Type

string — Google error message

$permission

$permission : \Google_Permission

Type

\Google_Permission — Google permission

$file

$file : \Google_DriveFile

Type

\Google_DriveFile — Google file

Methods

__construct()

__construct() : void

Create the QGoogleFile object.

__get()

__get(string $strName) : \Google_Permission|\Google_DriveFile|\Google_Client|\Google_DriveService|string|null

PHP Magic __get method implementation.

Parameters

string $strName

Name of the property to be fetched.

Throws

\Exception|\QCallerException

Returns

\Google_Permission|\Google_DriveFile|\Google_Client|\Google_DriveService|string|null

deleteFile()

deleteFile(string $fileId) : void

Delete pernamently the file.

Parameters

string $fileId

The ID of the file to delete.

trashFile()

trashFile(string $fileId) : void

Move the file to the trash.

Parameters

string $fileId

The ID of the file to move to the trash.

untrashFile()

untrashFile(string $fileId) : void

Move the file from the trash.

Parameters

string $fileId

The ID of the file to move from the trash.

shareFile()

shareFile(string $fileId, string $shared) : void

Share the file (insert new permission).

Parameters

string $fileId

The ID of the file to share.

string $shared

The value "public", "anyone" or e-mail adress.

retrievePermissions()

retrievePermissions(string $fileId) : Array

Retrieve a list of permissions for the file.

Parameters

string $fileId

The ID of the file to retrieve permissions for.

Returns

Array —

List of Google_Permission|null

noShareFile()

noShareFile(string $fileId) : void

Not share the file (delete all permissions from other users).

Parameters

string $fileId

The ID of the file to not share.

downloadFile()

downloadFile(string $fileId) : string|null

Get download url for the file.

Parameters

string $fileId

The ID of the file to download.

Returns

string|null

copyFile()

copyFile(string $fileId, string $copyTitle) : void

Copty the existing file.

Parameters

string $fileId

The ID of the origin file to copy.

string $copyTitle

The Title for the copied file.

renameFile()

renameFile(string $fileId, string $newTitle) : void

Rename the file.

Parameters

string $fileId

The ID of the file to rename.

string $newTitle

New title for the file.