Documentation

Google_Service_Drive_Resource_Files extends Google_Service_Resource
in package

The "files" collection of methods.

Typical usage is: $driveService = new Google_Service_Drive(...); $files = $driveService->files;

Table of Contents

$client  : Google_Client
$methods  : array<string|int, mixed>
$resourceName  : string
$rootUrl  : string
$serviceName  : string
$servicePath  : string
$stackParameters  : mixed
__construct()  : mixed
call()  : Google_Http_Request|expectedClass
TODO: This function needs simplifying.
copy()  : Google_Service_Drive_DriveFile
Creates a copy of a file and applies any requested updates with patch semantics. Folders cannot be copied. (files.copy)
create()  : Google_Service_Drive_DriveFile
Creates a new file. (files.create)
createRequestUri()  : string
Parse/expand request parameters and create a fully qualified request uri.
delete()  : mixed
Permanently deletes a file owned by the user without moving it to the trash.
emptyTrash()  : mixed
Permanently deletes all of the user's trashed files. (files.emptyTrash)
export()  : mixed
Exports a Google Doc to the requested MIME type and returns the exported content. Please note that the exported content is limited to 10MB.
generateIds()  : Google_Service_Drive_GeneratedIds
Generates a set of file IDs which can be provided in create or copy requests.
get()  : Google_Service_Drive_DriveFile
Gets a file's metadata or content by ID. (files.get)
listFiles()  : Google_Service_Drive_FileList
Lists or searches files. (files.listFiles)
update()  : Google_Service_Drive_DriveFile
Updates a file's metadata and/or content. This method supports patch semantics. (files.update)
watch()  : Google_Service_Drive_Channel
Subscribes to changes to a file (files.watch)
convertToArrayAndStripNulls()  : mixed

Properties

$methods

private array<string|int, mixed> $methods

$resourceName

private string $resourceName

$serviceName

private string $serviceName

$servicePath

private string $servicePath

$stackParameters

private mixed $stackParameters = array('alt' => array('type' => 'string', 'location' => 'query'), 'fields' => array('type' => 'string', 'location' => 'query'), 'trace' => array('type' => 'string', 'location' => 'query'), 'userIp' => array('type' => 'string', 'location' => 'query'), 'quotaUser' => array('type' => 'string', 'location' => 'query'), 'data' => array('type' => 'string', 'location' => 'body'), 'mimeType' => array('type' => 'string', 'location' => 'header'), 'uploadType' => array('type' => 'string', 'location' => 'query'), 'mediaUpload' => array('type' => 'complex', 'location' => 'query'), 'prettyPrint' => array('type' => 'string', 'location' => 'query'))

Methods

__construct()

public __construct(mixed $service, mixed $serviceName, mixed $resourceName, mixed $resource) : mixed
Parameters
$service : mixed
$serviceName : mixed
$resourceName : mixed
$resource : mixed
Return values
mixed

call()

TODO: This function needs simplifying.

public call( $name,  $arguments[,  $expectedClass = null ]) : Google_Http_Request|expectedClass
Parameters
$name :
$arguments :
$expectedClass : = null
  • optional, the expected class name
Tags
throws
Google_Exception
Return values
Google_Http_Request|expectedClass

copy()

Creates a copy of a file and applies any requested updates with patch semantics. Folders cannot be copied. (files.copy)

public copy(string $fileId, Google_Service_Drive_DriveFile $postBody[, array<string|int, mixed> $optParams = array() ]) : Google_Service_Drive_DriveFile
Parameters
$fileId : string

The ID of the file.

$postBody : Google_Service_Drive_DriveFile
$optParams : array<string|int, mixed> = array()

Optional parameters.

Tags
opt_param

bool enforceSingleParent Set to true to opt in to API behavior that aims for all items to have exactly one parent. This parameter only takes effect if the item is not in a shared drive. Requests that specify more than one parent fail.

opt_param

bool ignoreDefaultVisibility Whether to ignore the domain's default visibility settings for the created file. Domain administrators can choose to make all uploaded files visible to the domain by default; this parameter bypasses that behavior for the request. Permissions are still inherited from parent folders.

opt_param

string includePermissionsForView Specifies which additional view's permissions to include in the response. Only 'published' is supported.

opt_param

bool keepRevisionForever Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Google Drive. Only 200 revisions for the file can be kept forever. If the limit is reached, try deleting pinned revisions.

opt_param

string ocrLanguage A language hint for OCR processing during image import (ISO 639-1 code).

opt_param

bool supportsAllDrives Whether the requesting application supports both My Drives and shared drives.

opt_param

bool supportsTeamDrives Deprecated use supportsAllDrives instead.

Return values
Google_Service_Drive_DriveFile

create()

Creates a new file. (files.create)

public create(Google_Service_Drive_DriveFile $postBody[, array<string|int, mixed> $optParams = array() ]) : Google_Service_Drive_DriveFile
Parameters
$postBody : Google_Service_Drive_DriveFile
$optParams : array<string|int, mixed> = array()

Optional parameters.

Tags
opt_param

bool enforceSingleParent Set to true to opt in to API behavior that aims for all items to have exactly one parent. This parameter only takes effect if the item is not in a shared drive. Requests that specify more than one parent fail.

opt_param

bool ignoreDefaultVisibility Whether to ignore the domain's default visibility settings for the created file. Domain administrators can choose to make all uploaded files visible to the domain by default; this parameter bypasses that behavior for the request. Permissions are still inherited from parent folders.

opt_param

string includePermissionsForView Specifies which additional view's permissions to include in the response. Only 'published' is supported.

opt_param

bool keepRevisionForever Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Google Drive. Only 200 revisions for the file can be kept forever. If the limit is reached, try deleting pinned revisions.

opt_param

string ocrLanguage A language hint for OCR processing during image import (ISO 639-1 code).

opt_param

bool supportsAllDrives Whether the requesting application supports both My Drives and shared drives.

opt_param

bool supportsTeamDrives Deprecated use supportsAllDrives instead.

opt_param

bool useContentAsIndexableText Whether to use the uploaded content as indexable text.

Return values
Google_Service_Drive_DriveFile

createRequestUri()

Parse/expand request parameters and create a fully qualified request uri.

public createRequestUri(string $restPath, array<string|int, mixed> $params) : string
Parameters
$restPath : string
$params : array<string|int, mixed>
Tags
static
Return values
string

$requestUrl

delete()

Permanently deletes a file owned by the user without moving it to the trash.

public delete(string $fileId[, array<string|int, mixed> $optParams = array() ]) : mixed

If the file belongs to a shared drive the user must be an organizer on the parent. If the target is a folder, all descendants owned by the user are also deleted. (files.delete)

Parameters
$fileId : string

The ID of the file.

$optParams : array<string|int, mixed> = array()

Optional parameters.

Tags
opt_param

bool enforceSingleParent Set to true to opt in to API behavior that aims for all items to have exactly one parent. This parameter will only take effect if the item is not in a shared drive. If an item's last parent is deleted but the item itself is not, the item will be placed under its owner's root.

opt_param

bool supportsAllDrives Whether the requesting application supports both My Drives and shared drives.

opt_param

bool supportsTeamDrives Deprecated use supportsAllDrives instead.

Return values
mixed

emptyTrash()

Permanently deletes all of the user's trashed files. (files.emptyTrash)

public emptyTrash([array<string|int, mixed> $optParams = array() ]) : mixed
Parameters
$optParams : array<string|int, mixed> = array()

Optional parameters.

Tags
opt_param

bool enforceSingleParent Set to true to opt in to API behavior that aims for all items to have exactly one parent. This parameter will only take effect if the item is not in a shared drive. If an item's last parent is deleted but the item itself is not, the item will be placed under its owner's root.

Return values
mixed

export()

Exports a Google Doc to the requested MIME type and returns the exported content. Please note that the exported content is limited to 10MB.

public export(string $fileId, string $mimeType[, array<string|int, mixed> $optParams = array() ]) : mixed

(files.export)

Parameters
$fileId : string

The ID of the file.

$mimeType : string

The MIME type of the format requested for this export.

$optParams : array<string|int, mixed> = array()

Optional parameters.

Return values
mixed

generateIds()

Generates a set of file IDs which can be provided in create or copy requests.

public generateIds([array<string|int, mixed> $optParams = array() ]) : Google_Service_Drive_GeneratedIds

(files.generateIds)

Parameters
$optParams : array<string|int, mixed> = array()

Optional parameters.

Tags
opt_param

int count The number of IDs to return.

opt_param

string space The space in which the IDs can be used to create new files. Supported values are 'drive' and 'appDataFolder'.

Return values
Google_Service_Drive_GeneratedIds

get()

Gets a file's metadata or content by ID. (files.get)

public get(string $fileId[, array<string|int, mixed> $optParams = array() ]) : Google_Service_Drive_DriveFile
Parameters
$fileId : string

The ID of the file.

$optParams : array<string|int, mixed> = array()

Optional parameters.

Tags
opt_param

bool acknowledgeAbuse Whether the user is acknowledging the risk of downloading known malware or other abusive files. This is only applicable when alt=media.

opt_param

string includePermissionsForView Specifies which additional view's permissions to include in the response. Only 'published' is supported.

opt_param

bool supportsAllDrives Whether the requesting application supports both My Drives and shared drives.

opt_param

bool supportsTeamDrives Deprecated use supportsAllDrives instead.

Return values
Google_Service_Drive_DriveFile

listFiles()

Lists or searches files. (files.listFiles)

public listFiles([array<string|int, mixed> $optParams = array() ]) : Google_Service_Drive_FileList
Parameters
$optParams : array<string|int, mixed> = array()

Optional parameters.

Tags
opt_param

string corpora Groupings of files to which the query applies. Supported groupings are: 'user' (files created by, opened by, or shared directly with the user), 'drive' (files in the specified shared drive as indicated by the 'driveId'), 'domain' (files shared to the user's domain), and 'allDrives' (A combination of 'user' and 'drive' for all drives where the user is a member). When able, use 'user' or 'drive', instead of 'allDrives', for efficiency.

opt_param

string corpus The source of files to list. Deprecated: use 'corpora' instead.

opt_param

string driveId ID of the shared drive to search.

opt_param

bool includeItemsFromAllDrives Whether both My Drive and shared drive items should be included in results.

opt_param

string includePermissionsForView Specifies which additional view's permissions to include in the response. Only 'published' is supported.

opt_param

bool includeTeamDriveItems Deprecated use includeItemsFromAllDrives instead.

opt_param

string orderBy A comma-separated list of sort keys. Valid keys are 'createdTime', 'folder', 'modifiedByMeTime', 'modifiedTime', 'name', 'name_natural', 'quotaBytesUsed', 'recency', 'sharedWithMeTime', 'starred', and 'viewedByMeTime'. Each key sorts ascending by default, but may be reversed with the 'desc' modifier. Example usage: ?orderBy=folder,modifiedTime desc,name. Please note that there is a current limitation for users with approximately one million files in which the requested sort order is ignored.

opt_param

int pageSize The maximum number of files to return per page. Partial or empty result pages are possible even before the end of the files list has been reached.

opt_param

string pageToken The token for continuing a previous list request on the next page. This should be set to the value of 'nextPageToken' from the previous response.

opt_param

string q A query for filtering the file results. See the "Search for Files" guide for supported syntax.

opt_param

string spaces A comma-separated list of spaces to query within the corpus. Supported values are 'drive', 'appDataFolder' and 'photos'.

opt_param

bool supportsAllDrives Whether the requesting application supports both My Drives and shared drives.

opt_param

bool supportsTeamDrives Deprecated use supportsAllDrives instead.

opt_param

string teamDriveId Deprecated use driveId instead.

Return values
Google_Service_Drive_FileList

update()

Updates a file's metadata and/or content. This method supports patch semantics. (files.update)

public update(string $fileId, Google_Service_Drive_DriveFile $postBody[, array<string|int, mixed> $optParams = array() ]) : Google_Service_Drive_DriveFile
Parameters
$fileId : string

The ID of the file.

$postBody : Google_Service_Drive_DriveFile
$optParams : array<string|int, mixed> = array()

Optional parameters.

Tags
opt_param

string addParents A comma-separated list of parent IDs to add.

opt_param

bool enforceSingleParent Set to true to opt in to API behavior that aims for all items to have exactly one parent. This parameter only takes effect if the item is not in a shared drive. If the item's owner makes a request to add a single parent, the item is removed from all current folders and placed in the requested folder. Other requests that increase the number of parents fail, except when the canAddMyDriveParent file capability is true and a single parent is being added.

opt_param

string includePermissionsForView Specifies which additional view's permissions to include in the response. Only 'published' is supported.

opt_param

bool keepRevisionForever Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Google Drive. Only 200 revisions for the file can be kept forever. If the limit is reached, try deleting pinned revisions.

opt_param

string ocrLanguage A language hint for OCR processing during image import (ISO 639-1 code).

opt_param

string removeParents A comma-separated list of parent IDs to remove.

opt_param

bool supportsAllDrives Whether the requesting application supports both My Drives and shared drives.

opt_param

bool supportsTeamDrives Deprecated use supportsAllDrives instead.

opt_param

bool useContentAsIndexableText Whether to use the uploaded content as indexable text.

Return values
Google_Service_Drive_DriveFile

watch()

Subscribes to changes to a file (files.watch)

public watch(string $fileId, Google_Service_Drive_Channel $postBody[, array<string|int, mixed> $optParams = array() ]) : Google_Service_Drive_Channel
Parameters
$fileId : string

The ID of the file.

$postBody : Google_Service_Drive_Channel
$optParams : array<string|int, mixed> = array()

Optional parameters.

Tags
opt_param

bool acknowledgeAbuse Whether the user is acknowledging the risk of downloading known malware or other abusive files. This is only applicable when alt=media.

opt_param

string includePermissionsForView Specifies which additional view's permissions to include in the response. Only 'published' is supported.

opt_param

bool supportsAllDrives Whether the requesting application supports both My Drives and shared drives.

opt_param

bool supportsTeamDrives Deprecated use supportsAllDrives instead.

Return values
Google_Service_Drive_Channel

convertToArrayAndStripNulls()

protected convertToArrayAndStripNulls(mixed $o) : mixed
Parameters
$o : mixed
Return values
mixed

Search results