Nextcloud PHP API (master)

IAccount extends JsonSerializable

Interface IAccount

Tags
since
15.0.0

Table of Contents

Methods

getAllProperties()  : Generator<int, IAccountProperty>
Get all properties of an account. Array indices are numeric. To get the property name, call getName() against the value.
getFilteredProperties()  : array<string|int, IAccountProperty>
Get all properties that match the provided filters for scope and verification status
getProperties()  : array<string|int, mixed>
Get all properties of an account. Array indices are property names.
getProperty()  : IAccountProperty
Get a property by its key
getPropertyCollection()  : IAccountPropertyCollection
Returns the requested property collection (multi-value properties)
getUser()  : IUser
Get the related user for the account data
setAllPropertiesFromJson()  : IAccount
Set all properties of an account
setProperty()  : IAccount
Set a property with data
setPropertyCollection()  : IAccount
Set a property collection (multi-value properties)

Methods

getAllProperties()

Get all properties of an account. Array indices are numeric. To get the property name, call getName() against the value.

public getAllProperties() : Generator<int, IAccountProperty>

IAccountPropertyCollections are being flattened into an IAccountProperty for each value.

Tags
since
22.0.0
Return values
Generator<int, IAccountProperty>

getFilteredProperties()

Get all properties that match the provided filters for scope and verification status

public getFilteredProperties([string $scope = null ][, string $verified = null ]) : array<string|int, IAccountProperty>

Since 22.0.0 values from IAccountPropertyCollection are included, but also as IAccountProperty instances. They for properties of IAccountPropertyCollection are suffixed incrementally, i.e. #0, #1 ... #n – the numbers have no further meaning.

Parameters
$scope : string = null

Must be one of the VISIBILITY_ prefixed constants of \OCP\Accounts\IAccountManager

$verified : string = null

\OCP\Accounts\IAccountManager::NOT_VERIFIED | \OCP\Accounts\IAccountManager::VERIFICATION_IN_PROGRESS | \OCP\Accounts\IAccountManager::VERIFIED

Tags
since
15.0.0
Return values
array<string|int, IAccountProperty>

getProperties()

Get all properties of an account. Array indices are property names.

public getProperties() : array<string|int, mixed>

use getAllProperties()

Values from IAccountPropertyCollections are not included in the return array.

Tags
since
15.0.0
Return values
array<string|int, mixed>

getUser()

Get the related user for the account data

public getUser() : IUser
Tags
since
15.0.0
Return values
IUser

setAllPropertiesFromJson()

Set all properties of an account

public setAllPropertiesFromJson(array<string, array<string, string>>|array<string, array<int, array<string, string>>> $properties) : IAccount
Parameters
$properties : array<string, array<string, string>>|array<string, array<int, array<string, string>>>

e.g. [ 'displayname' => [ 'name' => 'displayname', 'value' => 'Jonathan Smith', 'scope' => 'v2-federated', 'verified' => '0', 'verificationData' => '', ], 'email' => [ 'name' => 'email', 'value' => 'jonathan@example.org', 'scope' => 'v2-federated', 'verified' => '0', 'verificationData' => '', ], // ... 'additional_mail' => [ [ 'name' => 'additional_mail', 'value' => 'jon@example.org', 'scope' => 'v2-local', 'verified' => '0', 'verificationData' => '', ], [ 'name' => 'additional_mail', 'value' => 'jon@earth.org', 'scope' => 'v2-local', 'verified' => '0', 'verificationData' => '', ], ], ]

Tags
since
24.0.0
Return values
IAccount

setProperty()

Set a property with data

public setProperty(string $property, string $value, string $scope, string $verified[, string $verificationData = '' ]) : IAccount
Parameters
$property : string

Must be one of the PROPERTY_ prefixed constants of \OCP\Accounts\IAccountManager

$value : string
$scope : string

Must be one of the VISIBILITY_ prefixed constants of \OCP\Accounts\IAccountManager

$verified : string

\OCP\Accounts\IAccountManager::NOT_VERIFIED | \OCP\Accounts\IAccountManager::VERIFICATION_IN_PROGRESS | \OCP\Accounts\IAccountManager::VERIFIED

$verificationData : string = ''

Optional, defaults to empty string. Since @22.0.0.

Tags
since
15.0.0
Return values
IAccount

        
On this page

Search results