The MessengerRepositoryContract is the interface for the messenger repository. This interface defines methods to add and show/list messages.
Plenty\Modules\Messenger\Contracts
public add(array $data):Message
Creates a new message.
array | $data | The message data to be loaded |
public show(string $uuid):void
Gets a message with all its successors.
string | $uuid | The UUID5 of the message |
public list(string $uuid = null, bool $successors = true, int $amount = self::DEFAULT_MESSAGES_AMOUNT):array
Lists messages. If no reference UUID5 is given, the method returns the $amount first messages. If $successor is set to FALSE, the messages older than the referenced message will be returned.
string | $uuid | The reference UUID5 of the message to start from (excluding). If not set, the uuid of the newest message will be used. |
bool | $successors | If set to FALSE, the messages older than the referenced message will be returned. |
int | $amount | The amount of messages to list (defaults to 50) |
public getMessages(int $page = self::DEFAULT_PAGE_OF_MESSAGES, int $itemsPerPage = self::DEFAULT_ITEMS_PER_PAGE_OF_MESSAGES):array
Lists messages.
int | $page | The number of the returned page of messages, default is 1 (the first) |
int | $itemsPerPage | The amount of messages to list (defaults to 50) |
public updateReadBy(int $readBy, string $uuid):void
Updates the readBy array of the message.
int | $readBy | The ID of the user who read the message |
string | $uuid | The UUID of the message |
public updateTags(array $tags, string $uuid):void
Updates the tags of the message.
array | $tags | Array of tag IDs of the message |
string | $uuid | The UUID of the message |
public updateVisibility(array $data, string $uuid):void
Updates the visibility of the message. Attributes that are updated are Message.visibility, Message.linkedTo and Message.accessFor.
array | $data | The message with the data to be updated |
string | $uuid | The UUID of the messages |
public updateControls(array $data, string $uuid):Message
Updates the message ui control options in the message meta data and returns the message.
array | $data | The controls data to be updated. |
string | $uuid | The uuid of the message. |
public setDone(string $doneAt = null, string $uuid):void
Sets the doneAt date in the message. If $doneAt is NULL, the doneAt date will be reset.
string | $doneAt | The doneAt date as ISO date string |
string | $uuid | The UUID of the message |
public delete(string $uuid):int
Deletes a message stream by the UUID. Returns the count of messages deleted.
string | $uuid | The UUID of the message |
public getAttachment(string $uuid, string $filename):Attachment
Gets a message attachment.
string | $uuid | The UUID of the message |
string | $filename | The file name of the attachment |
public updateMetaData(string $uuid, array $metaData):Message
Updates the meta data of the message.
string | $uuid | The UUID of the message |
array | $metaData | The meta data of the message |
public getTotalEntries():int
Returns total message entries
public setFilters(array $filters = []):void
Sets the filter array.
array | $filters |
public getFilters():void
Returns the filter array.
public getConditions():void
Returns a collection of parsed filters as Condition object
public clearFilters():void
Clears the filter array.
The event is triggered after a new message was created.
Plenty\Modules\Messenger\Events
public isFirstMessage():bool
If TRUE, the message is the first one. Otherwise, it is a reply message.
public getMessage():Message
Get the message.
The Attachment model of the messenger.
Plenty\Modules\Messenger\Models
Type | Name | Description |
---|---|---|
string | name | The file name of the attachment |
string | message | The UUID of the message the attachment belongs to |
int | size | The size of the attachment in bytes |
string | contentType | The content type fo the attachment |
string | content | The content of the attachment |
string | createdAt | The createdAt date of the attachment |
public toArray()
Returns this model as an array.
The Message model of the messenger.
Plenty\Modules\Messenger\Models
Type | Name | Description |
---|---|---|
string | uuid | The UUID5 identifier of the message |
string | plentyIdHash | The plenty ID hash |
string | parentUuid | The UUID5 of the parent message |
array | linkedTo | An array with MessageLinkedTo instances |
MessageFrom | from | The sender of the message as MessageFrom instance. |
MessageTo | to | The user and role IDs and emails receiving the message |
bool | whispered | Whether the message is whispered (not visible for the contact/order linked to the message) or not |
array | tags | An array with tag IDs assigned to the message |
string | title | The title of the message |
string | preview | The first two lines of the message without any markup |
string | message | The content of the message |
int | attachedFilesCount | The amount of attached files (readonly) |
MessageReferrer | referrer | The message referrer |
MessageMetaData | metaData | The meta data of the message |
string | doneAt | The date the messages was set to done |
string | createdAt | The creation date of the message |
string | updatedAt | The date of the last update of the message |
string | deletedAt | The date the message was deleted |
int | deletedBy | The ID of the user who deleted the message |
array | attachments | The message attachments |
public toArray()
Returns this model as an array.
The MessageFrom model of the messenger.
Plenty\Modules\Messenger\Models
Type | Name | Description |
---|---|---|
string | type | The type of the from instance (one of {@link MessageTypesService::FROM_TYPE_USER}, {@link MessageTypesService::FROM_TYPE_CONTACT} and {@link MessageTypesService::FROM_TYPE_EMAIL}) |
value | The value of the instance. For type {@link MessageTypesService::FROM_TYPE_EMAIL} it is a string (the email) and the id of the user or the contact otherwise. | |
string | name | An optional name for the instance, e.g. the real name for type {@link MessageTypesService::FROM_TYPE_EMAIL} |
public toArray()
Returns this model as an array.
The MessageLinkedTo model of the messenger.
Plenty\Modules\Messenger\Models
Type | Name | Description |
---|---|---|
string | type | The type of the link (one of {@link MessageTypesService::LINKED_TO_TYPE_MESSAGE}, {@link MessageTypesService::LINKED_TO_TYPE_ORDER}, {@link MessageTypesService::LINKED_TO_TYPE_CONTACT} and {@link MessageTypesService::LINKED_TO_TYPE_PAYMENT}) |
value | The value of the link. For type {@link MessageTypesService::LINKED_TO_TYPE_MESSAGE} it is a string (uuid5) and an integer otherwise. | |
typeId | This can be the ID of a sub-type (e.g. the order subTypeId). (optional) |
public toArray()
Returns this model as an array.
The MessageMetaData model of the messenger.
Plenty\Modules\Messenger\Models
Type | Name | Description |
---|---|---|
array | readBy | The array of users |
array | links | Array with links |
MessageMetaDataNotDone | notDoneByBackend | deactivates the toggle button in the messenger ui (backend) also has optional tooltips (reason for the deactivated toggle) |
MessageMetaDataControls | controls | An object with control options for the ui. |
MessageMetaDataTimeCapture | timeCapture | An object of the message time capture data |
int | plentyId | the plenty id of the related contact |
public toArray()
Returns this model as an array.
The message controls model. Currently supported controls:
Indicates whether or not is allowed to reply to this message stream (default true).
It is a global control and effects only in the parent message of a stream.</li>
Indicates whether or not is allowed to attach files in a message (default true).
It is a global control and effects only in the parent message of a stream.</li>
Indicates whether or not the message links should be disabled (default false).
It is a loacal control and effects every message.</li>
Plenty\Modules\Messenger\Models
Type | Name | Description |
---|---|---|
bool | replyable | Indicates whether or not is allowed to reply to this message stream (default true). |
bool | attachable | Indicates whether or not is allowed to attach files in a message (default true). |
bool | linksDisabled | Indicates whether or not the message links should be disabled (default false). |
public toArray()
Returns this model as an array.
The MessageMetaDataNotDone model of the messenger.
Plenty\Modules\Messenger\Models
Type | Name | Description |
---|---|---|
bool | deactivated | Deactivates the toggle button for the UI |
array | tooltips | Tooltips for the UI to show why the toggle is deactivated (if not set, show default values) |
public toArray()
Returns this model as an array.
The MessageMetaDataTimeCapture model of the messenger.
Plenty\Modules\Messenger\Models
Type | Name | Description |
---|---|---|
bool | chargeable | |
int | minutes |
public toArray()
Returns this model as an array.
The MessageMetaLink model of the messenger.
Plenty\Modules\Messenger\Models
Type | Name | Description |
---|---|---|
string | image | An optional image URL for the link |
string | caption | The caption to be shown for the link |
string | url | The link URL
|
string | type | One of the constants:
|
string | content | The reply content, only needed for type {@link MessageMetaLink::TYPE_REPLY} |
public toArray()
Returns this model as an array.
The MessageReferrer model of the messenger.
Plenty\Modules\Messenger\Models
Type | Name | Description |
---|---|---|
string | type | The type of the from instance (one of {@link MessageTypesService::REFERRER_TYPE_SYSTEM}, {@link MessageTypesService::REFERRER_TYPE_BACKEND}, {@link MessageTypesService::REFERRER_TYPE_REST} and {@link MessageTypesService::REFERRER_TYPE_PLUGIN}) |
value | The value of the instance. It is an integer (the user id) for type {@link MessageTypesService::REFERRER_TYPE_SYSTEM}, {@link MessageTypesService::REFERRER_TYPE_BACKEND} and {@link MessageTypesService::REFERRER_TYPE_REST} and a string (the plugin name) for type {@link MessageTypesService::REFERRER_TYPE_PLUGIN}. | |
string | name | An optional name for the instance. For type {@link MessageTypesService::REFERRER_TYPE_PLUGIN} it is the plugin namespace, the user name otherwise. |
public toArray()
Returns this model as an array.
The MessageTo model of the messenger.
Plenty\Modules\Messenger\Models
Type | Name | Description |
---|---|---|
array | user | An array with user IDs of users receiving the message |
array | role | An array with user role IDs of user roles receiving the message |
array | An array with emails receiving the message | |
bool | allUsers | Flag indicating that all system users receive the message |
public toArray()
Returns this model as an array.
Types and type validation for several types in the messenger.
Plenty\Modules\Messenger\Services
public static getValidLinkedToTypes():array
Gets the valid types for "linked to" references.
public static isValidLinkedTo(string $linkType, $linkValue):bool
Checks whether the given link is valid or not.
string | $linkType | The link type |
$linkValue | The link value |
public static getValidFromTypes():array
Gets the valid types for "from" references.
public static isValidFrom(string $fromType, $fromValue):bool
Checks whether the given from is valid or not.
string | $fromType | The from type |
$fromValue | The from value |
public static getValidReferrerTypes():array
Gets the valid types for "referrer" references.
public static isValidReferrer(string $referrerType, $referrerValue, string $referrerName = null):bool
Checks whether the given referrer reference is valid or not.
string | $referrerType | The reference to be checked |
$referrerValue | The value of the reference | |
string | $referrerName | The name of the reference |
public static getValidToTypes():array
Gets the valid key types for the 'to' array.
public static isValidTo(string $toKey):bool
Checks whether the given key has a valid value for to.
string | $toKey | The to key |
Search service for the messenger.
Plenty\Modules\Messenger\Services
public find(string $uuid):Message
Gets the message with the given uuid.
string | $uuid | The UUID of the message |
public findOrFail(string $uuid):Message
Gets the message with the given UUID.
string | $uuid | The UUID of the message |
public findMany(string $uuid):array
Gets a stream of messages. The given UUID can be the UUID of the first message in the stream or one of the replied messages.
string | $uuid | The UUID of the message |
public navigate(int $page = 1, int $itemsPerPage = 50):array
Lists the messages for the given navigation page.
int | $page | The page of results to search for |
int | $itemsPerPage | The number of items to list per page |
public getTotalEntries():int
Returns total entries
public toArray():array
public process(array $data):array
array | $data |
public getFilter():array
public getPostFilter():array
public getQuery():array
public getAggregations():array
public getSuggestions():array
public getSources():void
public addDependenciesToSource($sources):void
$sources |
public getName():void
public setName($name):void
$name |
public setIsSourceDisabled(bool $isSourceDisabled):void
bool | $isSourceDisabled |
public addFilter(TypeInterface $filter):Search
TypeInterface | $filter |
public addPostFilter(TypeInterface $filter):Search
TypeInterface | $filter |
public addQuery(TypeInterface $query):Search
TypeInterface | $query |
public addSource(SourceInterface $source):Search
SourceInterface | $source |
public setSorting(SortingInterface $sorting):Search
SortingInterface | $sorting |
public addAggregation(AggregationInterface $aggregation):Search
AggregationInterface | $aggregation |
public addSuggestion(SuggestionInterface $suggestion):Search
SuggestionInterface | $suggestion |
public setPage(int $page, int $rowsPerPage):Search
int | $page | |
int | $rowsPerPage |
public setPagination($pagination):void
$pagination |
public setCollapse(CollapseInterface $collapse):void
CollapseInterface | $collapse |
public setScoreModifier(ScoreModifierInterface $scoreModifier):Search
ScoreModifierInterface | $scoreModifier |
public setMaxResultWindow(int $maxResults = 10000):void
int | $maxResults |
public setIndex($index):void
$index |
public isSearchAfter():void
public getFilterRaw():void
public getQueriesRaw():void
public getAggregationsRaw():array
public getSorting():void
public getScoreModifier():void