Nextcloud PHP API (master)

IComment

Interface IComment

This class represents a comment

Tags
since
9.0.0

Table of Contents

Constants

MAX_MESSAGE_LENGTH  = 1000

Methods

getActorId()  : string
returns the actor ID
getActorType()  : string
returns the actor type
getChildrenCount()  : int
returns the number of children
getCreationDateTime()  : DateTime
returns the creation date of the comment.
getExpireDate()  : DateTime|null
Get message expire date
getId()  : string
returns the ID of the comment
getLatestChildDateTime()  : DateTime
returns the date of the most recent child
getMentions()  : array<string|int, mixed>
returns an array containing mentions that are included in the comment
getMessage()  : string
returns the message of the comment
getMetaData()  : array<string|int, mixed>|null
Returns the metadata of the comment
getObjectId()  : string
returns the object id the comment is attached to
getObjectType()  : string
returns the object type the comment is attached to
getParentId()  : string
returns the parent ID of the comment
getReactions()  : array<string, int>
Returns the reactions array if exists
getReferenceId()  : string|null
returns the reference id of the comment
getTopmostParentId()  : string
returns the topmost parent ID of the comment
getVerb()  : string
returns the verb of the comment
setActor()  : IComment
sets (overwrites) the actor type and id
setChildrenCount()  : IComment
sets the number of children
setCreationDateTime()  : IComment
sets the creation date of the comment and returns itself
setExpireDate()  : IComment
Set message expire date
setId()  : IComment
sets the ID of the comment and returns itself
setLatestChildDateTime()  : IComment
sets the date of the most recent child
setMessage()  : IComment
sets the message of the comment and returns itself
setMetaData()  : IComment
Sets (overwrites) the metadata of the comment Data as a json encoded array
setObject()  : IComment
sets (overwrites) the object of the comment
setParentId()  : IComment
sets the parent ID and returns itself
setReactions()  : IComment
Set summarized array of reactions by reaction type
setReferenceId()  : IComment
sets (overwrites) the reference id of the comment
setTopmostParentId()  : IComment
sets the topmost parent ID and returns itself
setVerb()  : IComment
sets the verb of the comment, e.g. 'comment' or 'like'

Constants

MAX_MESSAGE_LENGTH

public mixed MAX_MESSAGE_LENGTH = 1000
Tags
since
9.0.0

Methods

getActorId()

returns the actor ID

public getActorId() : string
Tags
since
9.0.0
Return values
string

getActorType()

returns the actor type

public getActorType() : string
Tags
since
9.0.0
Return values
string

getChildrenCount()

returns the number of children

public getChildrenCount() : int
Tags
since
9.0.0
Return values
int

getCreationDateTime()

returns the creation date of the comment.

public getCreationDateTime() : DateTime

If not explicitly set, it shall default to the time of initialization.

Tags
since
9.0.0
Return values
DateTime

getExpireDate()

Get message expire date

public getExpireDate() : DateTime|null
Tags
since
25.0.0
Return values
DateTime|null

getId()

returns the ID of the comment

public getId() : string

It may return an empty string, if the comment was not stored. It is expected that the concrete Comment implementation gives an ID by itself (e.g. after saving).

Tags
since
9.0.0
Return values
string

getLatestChildDateTime()

returns the date of the most recent child

public getLatestChildDateTime() : DateTime
Tags
since
9.0.0
Return values
DateTime

getMentions()

returns an array containing mentions that are included in the comment

public getMentions() : array<string|int, mixed>
Tags
since
11.0.0

The return array looks like: [ [ 'type' => 'user', 'id' => 'citizen4' ], [ 'type' => 'group', 'id' => 'media' ], … ]

Return values
array<string|int, mixed>

each mention provides a 'type' and an 'id', see example below

getMessage()

returns the message of the comment

public getMessage() : string
Tags
since
9.0.0
Return values
string

getMetaData()

Returns the metadata of the comment

public getMetaData() : array<string|int, mixed>|null
Tags
since
29.0.0
Return values
array<string|int, mixed>|null

getObjectId()

returns the object id the comment is attached to

public getObjectId() : string
Tags
since
9.0.0
Return values
string

getObjectType()

returns the object type the comment is attached to

public getObjectType() : string
Tags
since
9.0.0
Return values
string

getParentId()

returns the parent ID of the comment

public getParentId() : string
Tags
since
9.0.0
Return values
string

getReactions()

Returns the reactions array if exists

public getReactions() : array<string, int>

The keys is the emoji of reaction and the value is the total.

Tags
since
24.0.0
Return values
array<string, int>

e.g. ["👍":1]

getReferenceId()

returns the reference id of the comment

public getReferenceId() : string|null
Tags
since
19.0.0
Return values
string|null

getTopmostParentId()

returns the topmost parent ID of the comment

public getTopmostParentId() : string
Tags
since
9.0.0
Return values
string

getVerb()

returns the verb of the comment

public getVerb() : string
Tags
since
9.0.0
Return values
string

setActor()

sets (overwrites) the actor type and id

public setActor(string $actorType, string $actorId) : IComment
Parameters
$actorType : string

e.g. 'users'

$actorId : string

e.g. 'zombie234'

Tags
since
9.0.0
Return values
IComment

setChildrenCount()

sets the number of children

public setChildrenCount(int $count) : IComment
Parameters
$count : int
Tags
since
9.0.0
Return values
IComment

setCreationDateTime()

sets the creation date of the comment and returns itself

public setCreationDateTime(DateTime $dateTime) : IComment
Parameters
$dateTime : DateTime
Tags
since
9.0.0
Return values
IComment

setExpireDate()

Set message expire date

public setExpireDate(DateTime|null $dateTime) : IComment
Parameters
$dateTime : DateTime|null
Tags
since
25.0.0
Return values
IComment

setId()

sets the ID of the comment and returns itself

public setId(string $id) : IComment

It is only allowed to set the ID only, if the current id is an empty string (which means it is not stored in a database, storage or whatever the concrete implementation does), or vice versa. Changing a given ID is not permitted and must result in an IllegalIDChangeException.

Parameters
$id : string
Tags
throws
IllegalIDChangeException
since
9.0.0
Return values
IComment

setLatestChildDateTime()

sets the date of the most recent child

public setLatestChildDateTime([DateTime|null $dateTime = null ]) : IComment
Parameters
$dateTime : DateTime|null = null
Tags
since
9.0.0
Return values
IComment

setMessage()

sets the message of the comment and returns itself

public setMessage(string $message[, int $maxLength = self::MAX_MESSAGE_LENGTH ]) : IComment

When the given message length exceeds MAX_MESSAGE_LENGTH an MessageTooLongException shall be thrown.

Parameters
$message : string
$maxLength : int = self::MAX_MESSAGE_LENGTH
Tags
throws
MessageTooLongException
since
9.0.0
  • $maxLength added in 16.0.2
Return values
IComment

setMetaData()

Sets (overwrites) the metadata of the comment Data as a json encoded array

public setMetaData(array<string|int, mixed>|null $metaData) : IComment
Parameters
$metaData : array<string|int, mixed>|null
Tags
throws
JsonException

When the metadata can not be converted to a json encoded string

since
29.0.0
Return values
IComment

setObject()

sets (overwrites) the object of the comment

public setObject(string $objectType, string $objectId) : IComment
Parameters
$objectType : string

e.g. 'files'

$objectId : string

e.g. '16435'

Tags
since
9.0.0
Return values
IComment

setParentId()

sets the parent ID and returns itself

public setParentId(string $parentId) : IComment
Parameters
$parentId : string
Tags
since
9.0.0
Return values
IComment

setReactions()

Set summarized array of reactions by reaction type

public setReactions(array<string, int>|null $reactions) : IComment

The keys is the emoji of reaction and the value is the total.

Parameters
$reactions : array<string, int>|null

e.g. ["👍":1]

Tags
since
24.0.0
Return values
IComment

setReferenceId()

sets (overwrites) the reference id of the comment

public setReferenceId(string|null $referenceId) : IComment
Parameters
$referenceId : string|null

e.g. sha256 hash sum

Tags
since
19.0.0
Return values
IComment

setTopmostParentId()

sets the topmost parent ID and returns itself

public setTopmostParentId(string $id) : IComment
Parameters
$id : string
Tags
since
9.0.0
Return values
IComment

setVerb()

sets the verb of the comment, e.g. 'comment' or 'like'

public setVerb(string $verb) : IComment
Parameters
$verb : string
Tags
since
9.0.0
Return values
IComment

        
On this page

Search results