Nextcloud PHP API (master)

IFilesMetadata extends JsonSerializable

Model that represent metadata linked to a specific file.

Example of json stored in the database { "mymeta": { "value": "this is a test", "type": "string", "etag": "abcd1234", "indexed": false, "editPermission": 1 }, "myapp-anothermeta": { "value": 42, "type": "int", "etag": "0987zyxw", "indexed": true, "editPermission": 0 } }

Tags
see
IMetadataValueWrapper
since
28.0.0

Table of Contents

Methods

asArray()  : array<string|int, mixed>
returns metadata in a simple array with METADATA_KEY => METADATA_VALUE
getArray()  : array<string|int, mixed>
returns array for a metadata key
getBool()  : bool
returns bool value for a metadata key
getEditPermission()  : int
returns remote edit permission (Webdav PROPPATCH)
getEtag()  : string
returns file etag stored during the last update of the metadata key
getFileId()  : int
returns the file id linked to this metadata
getFloat()  : float
returns float value for a metadata key
getIndexes()  : array<string|int, string>
return the list of metadata keys set as indexed
getInt()  : int
returns int value for a metadata key
getIntList()  : array<string|int, int>
returns int[] value for a metadata key
getKeys()  : array<string|int, string>
returns all current metadata keys
getString()  : string
returns string value for a metadata key
getStringList()  : array<string|int, string>
returns string[] value for a metadata key
getSyncToken()  : string
returns the token known at the time the metadata were extracted from database
getType()  : string
returns the value type of the metadata (string, int, ...)
hasKey()  : bool
returns true if search metadata key exists
import()  : self
deserialize the object from a json
isIndex()  : bool
returns true if key exists and is set as indexed
lastUpdateTimestamp()  : int
returns last time metadata were updated in the database
removeStartsWith()  : self
unset metadata with key starting with prefix
setArray()  : self
set a metadata key/value pair for array
setBool()  : self
set a metadata key/value pair for bool value
setEditPermission()  : void
set remote edit permission (Webdav PROPPATCH)
setEtag()  : void
set file etag
setFloat()  : self
set a metadata key/value pair for float value
setInt()  : self
set a metadata key/value pair for int value
setIntList()  : self
set a metadata key/value pair for list of int
setString()  : self
set a metadata key/value pair for string value
setStringList()  : self
set a metadata key/value pair for list of string
unset()  : self
unset a metadata
updated()  : bool
returns true if object have been updated since last import

Methods

asArray()

returns metadata in a simple array with METADATA_KEY => METADATA_VALUE

public asArray() : array<string|int, mixed>
Tags
since
28.0.0
Return values
array<string|int, mixed>

metadata

getEditPermission()

returns remote edit permission (Webdav PROPPATCH)

public getEditPermission(string $key) : int
Parameters
$key : string

metadata key

Tags
since
28.0.0
Return values
int

getEtag()

returns file etag stored during the last update of the metadata key

public getEtag(string $key) : string
Parameters
$key : string

metadata key

Tags
since
29.0.0
Return values
string

getFileId()

returns the file id linked to this metadata

public getFileId() : int
Tags
since
28.0.0
Return values
int

related file id

getIndexes()

return the list of metadata keys set as indexed

public getIndexes() : array<string|int, string>
Tags
since
28.0.0
Return values
array<string|int, string>

list of indexes

getKeys()

returns all current metadata keys

public getKeys() : array<string|int, string>
Tags
since
28.0.0
Return values
array<string|int, string>

list of keys

getSyncToken()

returns the token known at the time the metadata were extracted from database

public getSyncToken() : string
Tags
since
28.0.0
Return values
string

token

getType()

returns the value type of the metadata (string, int, ...)

public getType(string $key) : string
Parameters
$key : string

metadata key

Tags
throws
FilesMetadataNotFoundException
see
IMetadataValueWrapper::TYPE_STRING
see
IMetadataValueWrapper::TYPE_INT
see
IMetadataValueWrapper::TYPE_FLOAT
see
IMetadataValueWrapper::TYPE_BOOL
see
IMetadataValueWrapper::TYPE_ARRAY
see
IMetadataValueWrapper::TYPE_STRING_LIST
see
IMetadataValueWrapper::TYPE_INT_LIST
since
28.0.0
Return values
string

value type

hasKey()

returns true if search metadata key exists

public hasKey(string $needle) : bool
Parameters
$needle : string

metadata key to search

Tags
since
28.0.0
Return values
bool

TRUE if key exist

import()

deserialize the object from a json

public import(array<string|int, mixed> $data) : self
Parameters
$data : array<string|int, mixed>

serialized version of the object

Tags
see
jsonSerialize
since
28.0.0
Return values
self

isIndex()

returns true if key exists and is set as indexed

public isIndex(string $key) : bool
Parameters
$key : string

metadata key

Tags
since
28.0.0
Return values
bool

lastUpdateTimestamp()

returns last time metadata were updated in the database

public lastUpdateTimestamp() : int
Tags
since
28.0.0
Return values
int

timestamp

removeStartsWith()

unset metadata with key starting with prefix

public removeStartsWith(string $keyPrefix) : self
Parameters
$keyPrefix : string

metadata key prefix

Tags
since
28.0.0
Return values
self

setArray()

set a metadata key/value pair for array

public setArray(string $key, array<string|int, mixed> $value) : self
Parameters
$key : string

metadata key

$value : array<string|int, mixed>

metadata value

Tags
since
28.0.0
Return values
self

setBool()

set a metadata key/value pair for bool value

public setBool(string $key, bool $value[, bool $index = false ]) : self
Parameters
$key : string

metadata key

$value : bool

metadata value

$index : bool = false

set TRUE if value must be indexed

Tags
since
28.0.0
Return values
self

setEditPermission()

set remote edit permission (Webdav PROPPATCH)

public setEditPermission(string $key, int $permission) : void
Parameters
$key : string

metadata key

$permission : int

remote edit permission

Tags
since
28.0.0

setEtag()

set file etag

public setEtag(string $key, string $etag) : void
Parameters
$key : string

metadata key

$etag : string
Tags
since
29.0.0

setFloat()

set a metadata key/value pair for float value

public setFloat(string $key, float $value) : self
Parameters
$key : string

metadata key

$value : float

metadata value

Tags
since
28.0.0
Return values
self

setInt()

set a metadata key/value pair for int value

public setInt(string $key, int $value[, bool $index = false ]) : self
Parameters
$key : string

metadata key

$value : int

metadata value

$index : bool = false

set TRUE if value must be indexed

Tags
since
28.0.0
Return values
self

setIntList()

set a metadata key/value pair for list of int

public setIntList(string $key, array<string|int, int> $value[, bool $index = false ]) : self
Parameters
$key : string

metadata key

$value : array<string|int, int>

metadata value

$index : bool = false

set TRUE if each values from the list must be indexed

Tags
since
28.0.0
Return values
self

setString()

set a metadata key/value pair for string value

public setString(string $key, string $value[, bool $index = false ]) : self
Parameters
$key : string

metadata key

$value : string

metadata value

$index : bool = false

set TRUE if value must be indexed

Tags
since
28.0.0
Return values
self

setStringList()

set a metadata key/value pair for list of string

public setStringList(string $key, array<string|int, string> $value[, bool $index = false ]) : self
Parameters
$key : string

metadata key

$value : array<string|int, string>

metadata value

$index : bool = false

set TRUE if each values from the list must be indexed

Tags
since
28.0.0
Return values
self

unset()

unset a metadata

public unset(string $key) : self
Parameters
$key : string

metadata key

Tags
since
28.0.0
Return values
self

updated()

returns true if object have been updated since last import

public updated() : bool
Tags
since
28.0.0
Return values
bool

TRUE if metadata have been modified


        
On this page

Search results