Search moodle.org's
Developer Documentation

  • Bug fixes for general core bugs in 3.11.x will end 9 May 2022 (12 months).
  • Bug fixes for security issues in 3.11.x will end 14 November 2022 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.
  • Differences Between: [Versions 310 and 311] [Versions 35 and 311] [Versions 36 and 311] [Versions 37 and 311] [Versions 38 and 311] [Versions 39 and 311]

    External message API

    Copyright: 2011 Jerome Mouneyrac
    License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
    File Size: 3625 lines (142 kb)
    Included or required:0 times
    Referenced: 41 times
    Includes or requires: 0 files

    Defines 1 class

    core_message_external:: (129 methods):
      send_messages_to_conversation_parameters()
      send_messages_to_conversation()
      send_messages_to_conversation_returns()
      send_instant_messages_parameters()
      send_instant_messages()
      send_instant_messages_returns()
      delete_contacts_parameters()
      delete_contacts()
      delete_contacts_returns()
      mute_conversations_parameters()
      mute_conversations()
      mute_conversations_returns()
      unmute_conversations_parameters()
      unmute_conversations()
      unmute_conversations_returns()
      block_user_parameters()
      block_user()
      block_user_returns()
      unblock_user_parameters()
      unblock_user()
      unblock_user_returns()
      get_contact_requests_parameters()
      get_contact_requests()
      get_contact_requests_returns()
      get_received_contact_requests_count_parameters()
      get_received_contact_requests_count()
      get_received_contact_requests_count_returns()
      get_conversation_members_parameters()
      get_conversation_members()
      get_conversation_members_returns()
      create_contact_request_parameters()
      create_contact_request()
      create_contact_request_returns()
      confirm_contact_request_parameters()
      confirm_contact_request()
      confirm_contact_request_returns()
      decline_contact_request_parameters()
      decline_contact_request()
      decline_contact_request_returns()
      get_messagearea_contact_structure()
      get_conversation_structure()
      get_conversation_member_structure()
      get_conversation_message_structure()
      message_search_users_parameters()
      message_search_users()
      message_search_users_returns()
      data_for_messagearea_search_messages_parameters()
      data_for_messagearea_search_messages()
      data_for_messagearea_search_messages_returns()
      get_conversations_parameters()
      get_conversations()
      get_conversations_returns()
      get_conversation_parameters()
      get_conversation()
      get_conversation_returns()
      get_conversation_between_users_parameters()
      get_conversation_between_users()
      get_conversation_between_users_returns()
      get_self_conversation_parameters()
      get_self_conversation()
      get_self_conversation_returns()
      get_conversation_messages_parameters()
      get_conversation_messages()
      get_conversation_messages_returns()
      get_user_contacts_parameters()
      get_user_contacts()
      get_user_contacts_returns()
      search_contacts_parameters()
      search_contacts()
      search_contacts_returns()
      get_messages_parameters()
      get_messages()
      get_messages_returns()
      mark_all_notifications_as_read_parameters()
      mark_all_notifications_as_read()
      mark_all_notifications_as_read_returns()
      get_unread_conversations_count_parameters()
      get_unread_conversations_count()
      get_unread_conversations_count_returns()
      get_blocked_users_parameters()
      get_blocked_users()
      get_blocked_users_returns()
      mark_message_read_parameters()
      mark_message_read()
      mark_message_read_returns()
      mark_notification_read_parameters()
      mark_notification_read()
      mark_notification_read_returns()
      mark_all_conversation_messages_as_read_parameters()
      mark_all_conversation_messages_as_read()
      mark_all_conversation_messages_as_read_returns()
      delete_conversations_by_id_parameters()
      delete_conversations_by_id()
      delete_conversations_by_id_returns()
      delete_message_parameters()
      delete_message()
      delete_message_returns()
      message_processor_config_form_parameters()
      message_processor_config_form()
      message_processor_config_form_returns()
      get_message_processor_parameters()
      get_message_processor()
      get_message_processor_returns()
      validate_preferences_permissions()
      get_preferences_structure()
      get_user_notification_preferences_parameters()
      get_user_notification_preferences()
      get_user_notification_preferences_returns()
      get_user_message_preferences_parameters()
      get_user_message_preferences()
      get_user_message_preferences_returns()
      set_favourite_conversations_parameters()
      set_favourite_conversations()
      set_favourite_conversations_returns()
      unset_favourite_conversations_parameters()
      unset_favourite_conversations()
      unset_favourite_conversations_returns()
      get_member_info_parameters()
      get_member_info()
      get_member_info_returns()
      get_conversation_counts_parameters()
      get_conversation_counts()
      get_conversation_counts_returns()
      get_unread_conversation_counts_parameters()
      get_unread_conversation_counts()
      get_unread_conversation_counts_returns()
      delete_message_for_all_users_parameters()
      delete_message_for_all_users()
      delete_message_for_all_users_returns()


    Class: core_message_external  - X-Ref

    Message external functions

    send_messages_to_conversation_parameters()   X-Ref
    Returns description of method parameters

    return: external_function_parameters

    send_messages_to_conversation(int $conversationid, array $messages = [])   X-Ref
    Send messages from the current USER to a conversation.

    This conversation may be any type of conversation, individual or group.

    return: array the array of messages which were sent (created).
    param: int $conversationid the id of the conversation to which the messages will be sent.
    param: array $messages An array of message to send.

    send_messages_to_conversation_returns()   X-Ref
    Returns description of method result value.

    return: external_description

    send_instant_messages_parameters()   X-Ref
    Returns description of method parameters

    return: external_function_parameters

    send_instant_messages($messages = array()   X-Ref
    Send private messages from the current USER to other users

    return: array
    param: array $messages An array of message to send.

    send_instant_messages_returns()   X-Ref
    Returns description of method result value

    return: external_description

    delete_contacts_parameters()   X-Ref
    Delete contacts parameters description.

    return: external_function_parameters

    delete_contacts($userids, $userid = 0)   X-Ref
    Delete contacts.

    return: null
    param: array $userids array of user IDs.
    param: int $userid The id of the user we are deleting the contacts for

    delete_contacts_returns()   X-Ref
    Delete contacts return description.

    return: external_description

    mute_conversations_parameters()   X-Ref
    Mute conversations parameters description.

    return: external_function_parameters

    mute_conversations(int $userid, array $conversationids)   X-Ref
    Mutes conversations.

    return: external_description
    param: int $userid The id of the user who is blocking
    param: array $conversationids The list of conversations being muted

    mute_conversations_returns()   X-Ref
    Mute conversations return description.

    return: external_description

    unmute_conversations_parameters()   X-Ref
    Unmute conversations parameters description.

    return: external_function_parameters

    unmute_conversations(int $userid, array $conversationids)   X-Ref
    Unmute conversations.

    param: int $userid The id of the user who is unblocking
    param: array $conversationids The list of conversations being muted

    unmute_conversations_returns()   X-Ref
    Unmute conversations return description.

    return: external_description

    block_user_parameters()   X-Ref
    Block user parameters description.

    return: external_function_parameters

    block_user(int $userid, int $blockeduserid)   X-Ref
    Blocks a user.

    return: external_description
    param: int $userid The id of the user who is blocking
    param: int $blockeduserid The id of the user being blocked

    block_user_returns()   X-Ref
    Block user return description.

    return: external_description

    unblock_user_parameters()   X-Ref
    Unblock user parameters description.

    return: external_function_parameters

    unblock_user(int $userid, int $unblockeduserid)   X-Ref
    Unblock user.

    param: int $userid The id of the user who is unblocking
    param: int $unblockeduserid The id of the user being unblocked

    unblock_user_returns()   X-Ref
    Unblock user return description.

    return: external_description

    get_contact_requests_parameters()   X-Ref
    Returns contact requests parameters description.

    return: external_function_parameters

    get_contact_requests(int $userid, int $limitfrom = 0, int $limitnum = 0)   X-Ref
    Handles returning the contact requests for a user.

    This also includes the user data necessary to display information
    about the user.

    It will not include blocked users.

    param: int $userid The id of the user we want to get the contact requests for
    param: int $limitfrom
    param: int $limitnum

    get_contact_requests_returns()   X-Ref
    Returns the contact requests return description.

    return: external_description

    get_received_contact_requests_count_parameters()   X-Ref
    Returns the number of contact requests the user has received parameters description.

    return: external_function_parameters

    get_received_contact_requests_count(int $userid)   X-Ref
    Returns the number of contact requests the user has received.

    return: external_value
    param: int $userid The ID of the user we want to return the number of received contact requests for

    get_received_contact_requests_count_returns()   X-Ref
    Returns the number of contact requests the user has received return description.

    return: external_value

    get_conversation_members_parameters()   X-Ref
    Returns get conversation members parameters description.

    return: external_function_parameters

    get_conversation_members(int $userid, int $conversationid, bool $includecontactrequests = false,bool $includeprivacyinfo = false, int $limitfrom = 0, int $limitnum = 0)   X-Ref
    Returns a list of conversation members.

    return: array
    param: int $userid The user we are returning the conversation members for, used by helper::get_member_info.
    param: int $conversationid The id of the conversation
    param: bool $includecontactrequests Do we want to include contact requests with this data?
    param: bool $includeprivacyinfo Do we want to include privacy info?
    param: int $limitfrom
    param: int $limitnum

    get_conversation_members_returns()   X-Ref
    Returns the get conversation members return description.

    return: external_description

    create_contact_request_parameters()   X-Ref
    Creates a contact request parameters description.

    return: external_function_parameters

    create_contact_request(int $userid, int $requesteduserid)   X-Ref
    Creates a contact request.

    param: int $userid The id of the user who is creating the contact request
    param: int $requesteduserid The id of the user being requested

    create_contact_request_returns()   X-Ref
    Creates a contact request return description.

    return: external_description

    confirm_contact_request_parameters()   X-Ref
    Confirm a contact request parameters description.

    return: external_function_parameters

    confirm_contact_request(int $userid, int $requesteduserid)   X-Ref
    Confirm a contact request.

    param: int $userid The id of the user who is creating the contact request
    param: int $requesteduserid The id of the user being requested

    confirm_contact_request_returns()   X-Ref
    Confirm a contact request return description.

    return: external_description

    decline_contact_request_parameters()   X-Ref
    Declines a contact request parameters description.

    return: external_function_parameters

    decline_contact_request(int $userid, int $requesteduserid)   X-Ref
    Declines a contact request.

    param: int $userid The id of the user who is creating the contact request
    param: int $requesteduserid The id of the user being requested

    decline_contact_request_returns()   X-Ref
    Declines a contact request return description.

    return: external_description

    get_messagearea_contact_structure()   X-Ref
    Return the structure of a message area contact.

    return: external_single_structure

    get_conversation_structure()   X-Ref
    Return the structure of a conversation.

    return: external_single_structure

    get_conversation_member_structure()   X-Ref
    Return the structure of a conversation member.

    return: external_single_structure

    get_conversation_message_structure()   X-Ref
    Return the structure of a message area message.

    return: external_single_structure

    message_search_users_parameters()   X-Ref
    Get messagearea message search users parameters.

    return: external_function_parameters

    message_search_users($userid, $search, $limitfrom = 0, $limitnum = 0)   X-Ref
    Get search users results.

    return: array
    param: int $userid The id of the user who is performing the search
    param: string $search The string being searched
    param: int $limitfrom
    param: int $limitnum

    message_search_users_returns()   X-Ref
    Get messagearea message search users returns.

    return: external_single_structure

    data_for_messagearea_search_messages_parameters()   X-Ref
    Get messagearea search messages parameters.

    return: external_function_parameters

    data_for_messagearea_search_messages($userid, $search, $limitfrom = 0, $limitnum = 0)   X-Ref
    Get messagearea search messages results.

    return: stdClass
    param: int $userid The id of the user who is performing the search
    param: string $search The string being searched
    param: int $limitfrom
    param: int $limitnum

    data_for_messagearea_search_messages_returns()   X-Ref
    Get messagearea search messages returns.

    return: external_single_structure

    get_conversations_parameters()   X-Ref
    Get conversations parameters.

    return: external_function_parameters

    get_conversations($userid, $limitfrom = 0, $limitnum = 0, int $type = null, bool $favourites = null,bool $mergeself = false)   X-Ref
    Get the list of conversations for the user.

    return: stdClass
    param: int $userid The id of the user who is performing the search
    param: int $limitfrom
    param: int $limitnum
    param: int|null $type
    param: bool|null $favourites
    param: bool $mergeself whether to include self-conversations (true) or ONLY private conversations (false)

    get_conversations_returns()   X-Ref
    Get conversations returns.

    return: external_single_structure

    get_conversation_parameters()   X-Ref
    Get conversation parameters.

    return: external_function_parameters

    get_conversation(int $userid,int $conversationid,bool $includecontactrequests = false,bool $includeprivacyinfo = false,int $memberlimit = 0,int $memberoffset = 0,int $messagelimit = 0,int $messageoffset = 0,bool $newestmessagesfirst = true)   X-Ref
    Get a single conversation.

    return: stdClass
    param: int $userid The user id to get the conversation for
    param: int $conversationid The id of the conversation to fetch
    param: bool $includecontactrequests Should contact requests be included between members
    param: bool $includeprivacyinfo Should privacy info be included between members
    param: int $memberlimit Limit number of members to load
    param: int $memberoffset Offset members by this amount
    param: int $messagelimit Limit number of messages to load
    param: int $messageoffset Offset the messages
    param: bool $newestmessagesfirst Order messages by newest first

    get_conversation_returns()   X-Ref
    Get conversation returns.

    return: external_single_structure

    get_conversation_between_users_parameters()   X-Ref
    Get conversation parameters.

    return: external_function_parameters

    get_conversation_between_users(int $userid,int $otheruserid,bool $includecontactrequests = false,bool $includeprivacyinfo = false,int $memberlimit = 0,int $memberoffset = 0,int $messagelimit = 0,int $messageoffset = 0,bool $newestmessagesfirst = true)   X-Ref
    Get a single conversation between users.

    return: stdClass
    param: int $userid The user id to get the conversation for
    param: int $otheruserid The other user id
    param: bool $includecontactrequests Should contact requests be included between members
    param: bool $includeprivacyinfo Should privacy info be included between members
    param: int $memberlimit Limit number of members to load
    param: int $memberoffset Offset members by this amount
    param: int $messagelimit Limit number of messages to load
    param: int $messageoffset Offset the messages
    param: bool $newestmessagesfirst Order messages by newest first

    get_conversation_between_users_returns()   X-Ref
    Get conversation returns.

    return: external_single_structure

    get_self_conversation_parameters()   X-Ref
    Get self-conversation parameters.

    return: external_function_parameters

    get_self_conversation(int $userid,int $messagelimit = 0,int $messageoffset = 0,bool $newestmessagesfirst = true)   X-Ref
    Get a single self-conversation.

    return: stdClass
    param: int $userid The user id to get the self-conversation for
    param: int $messagelimit Limit number of messages to load
    param: int $messageoffset Offset the messages
    param: bool $newestmessagesfirst Order messages by newest first

    get_self_conversation_returns()   X-Ref
    Get conversation returns.

    return: external_single_structure

    get_conversation_messages_parameters()   X-Ref
    The conversation messages parameters.

    return: external_function_parameters

    get_conversation_messages(int $currentuserid, int $convid, int $limitfrom = 0, int $limitnum = 0,bool $newest = false, int $timefrom = 0)   X-Ref
    Get conversation messages.

    return: array The messages and members who have sent some of these messages.
    param: int $currentuserid The current user's id.
    param: int $convid The conversation id.
    param: int $limitfrom Return a subset of records, starting at this point (optional).
    param: int $limitnum Return a subset comprising this many records in total (optional, required if $limitfrom is set).
    param: bool $newest True for getting first newest messages, false otherwise.
    param: int  $timefrom The time from the conversation messages to get.

    get_conversation_messages_returns()   X-Ref
    The messagearea messages return structure.

    return: external_single_structure

    get_user_contacts_parameters()   X-Ref
    The user contacts return parameters.

    return: external_function_parameters

    get_user_contacts(int $userid, int $limitfrom = 0, int $limitnum = 0)   X-Ref
    Get user contacts.

    return: array
    param: int $userid The id of the user who we are viewing conversations for
    param: int $limitfrom
    param: int $limitnum

    get_user_contacts_returns()   X-Ref
    The user contacts return structure.

    return: external_multiple_structure

    search_contacts_parameters()   X-Ref
    Search contacts parameters description.

    return: external_function_parameters

    search_contacts($searchtext, $onlymycourses = false)   X-Ref
    Search contacts.

    return: external_description
    param: string $searchtext query string.
    param: bool $onlymycourses limit the search to the user's courses only.

    search_contacts_returns()   X-Ref
    Search contacts return description.

    return: external_description

    get_messages_parameters()   X-Ref
    Get messages parameters description.

    return: external_function_parameters

    get_messages($useridto, $useridfrom = 0, $type = 'both', $read = true,$newestfirst = true, $limitfrom = 0, $limitnum = 0)   X-Ref
    Get messages function implementation.

    return: external_description
    param: int      $useridto       the user id who received the message
    param: int      $useridfrom     the user id who send the message. -10 or -20 for no-reply or support user
    param: string   $type           type of message to return, expected values: notifications, conversations and both
    param: bool     $read           true for retreiving read messages, false for unread
    param: bool     $newestfirst    true for ordering by newest first, false for oldest first
    param: int      $limitfrom      limit from
    param: int      $limitnum       limit num

    get_messages_returns()   X-Ref
    Get messages return description.

    return: external_single_structure

    mark_all_notifications_as_read_parameters()   X-Ref
    Mark all notifications as read parameters description.

    return: external_function_parameters

    mark_all_notifications_as_read($useridto, $useridfrom, $timecreatedto = 0)   X-Ref
    Mark all notifications as read function.

    return: external_description
    param: int      $useridto       the user id who received the message
    param: int      $useridfrom     the user id who send the message. -10 or -20 for no-reply or support user
    param: int      $timecreatedto  mark message created before this time as read, 0 for all messages

    mark_all_notifications_as_read_returns()   X-Ref
    Mark all notifications as read return description.

    return: external_single_structure

    get_unread_conversations_count_parameters()   X-Ref
    Get unread conversations count parameters description.

    return: external_function_parameters

    get_unread_conversations_count($useridto)   X-Ref
    Get unread messages count function.

    return: external_description
    param: int      $useridto       the user id who received the message

    get_unread_conversations_count_returns()   X-Ref
    Get unread conversations count return description.

    return: external_single_structure

    get_blocked_users_parameters()   X-Ref
    Get blocked users parameters description.

    return: external_function_parameters

    get_blocked_users($userid)   X-Ref
    Retrieve a list of users blocked

    return: external_description
    param: int $userid the user whose blocked users we want to retrieve

    get_blocked_users_returns()   X-Ref
    Get blocked users return description.

    return: external_single_structure

    mark_message_read_parameters()   X-Ref
    Returns description of method parameters

    return: external_function_parameters

    mark_message_read($messageid, $timeread)   X-Ref
    Mark a single message as read, trigger message_viewed event

    return: external_description
    param: int $messageid id of the message (in the message table)
    param: int $timeread timestamp for when the message should be marked read

    mark_message_read_returns()   X-Ref
    Returns description of method result value

    return: external_description

    mark_notification_read_parameters()   X-Ref
    Returns description of method parameters

    return: external_function_parameters

    mark_notification_read($notificationid, $timeread)   X-Ref
    Mark a single notification as read.

    This will trigger a 'notification_viewed' event.

    return: external_description
    param: int $notificationid id of the notification
    param: int $timeread timestamp for when the notification should be marked read

    mark_notification_read_returns()   X-Ref
    Returns description of method result value

    return: external_description

    mark_all_conversation_messages_as_read_parameters()   X-Ref
    Mark all conversation messages as read parameters description.

    return: external_function_parameters

    mark_all_conversation_messages_as_read(int $userid, int $conversationid)   X-Ref
    Mark all conversation messages as read function.

    param: int $userid The user id of who we want to delete the conversation for
    param: int $conversationid The id of the conversations

    mark_all_conversation_messages_as_read_returns()   X-Ref
    Mark all conversation messages as read return description.

    return: external_warnings

    delete_conversations_by_id_parameters()   X-Ref
    Returns description of method parameters.

    return: external_function_parameters

    delete_conversations_by_id($userid, array $conversationids)   X-Ref
    Deletes a conversation.

    return: array
    param: int $userid The user id of who we want to delete the conversation for
    param: int[] $conversationids The ids of the conversations

    delete_conversations_by_id_returns()   X-Ref
    Returns description of method result value.

    return: external_description

    delete_message_parameters()   X-Ref
    Returns description of method parameters

    return: external_function_parameters

    delete_message($messageid, $userid, $read = true)   X-Ref
    Deletes a message

    return: external_description
    param: int $messageid the message id
    param: int $userid the user id of who we want to delete the message for
    param: bool $read if is a message read (default to true)

    delete_message_returns()   X-Ref
    Returns description of method result value

    return: external_description

    message_processor_config_form_parameters()   X-Ref
    Returns description of method parameters

    return: external_function_parameters

    message_processor_config_form($userid, $name, $formvalues)   X-Ref
    Processes a message processor config form.

    return: external_description
    param: int $userid the user id
    param: string $name the name of the processor
    param: array $formvalues the form values

    message_processor_config_form_returns()   X-Ref
    Returns description of method result value

    return: external_description

    get_message_processor_parameters()   X-Ref
    Returns description of method parameters

    return: external_function_parameters

    get_message_processor($userid, $name)   X-Ref
    Get a message processor.

    return: external_description
    param: int $userid
    param: string $name the name of the processor

    get_message_processor_returns()   X-Ref
    Returns description of method result value

    return: external_description

    validate_preferences_permissions($userid)   X-Ref
    Check that the user has enough permission to retrieve message or notifications preferences.

    return: stdClass full user object
    param: int $userid the user id requesting the preferences

    get_preferences_structure()   X-Ref
    Returns a notification or message preference structure.

    return: external_single_structure the structure

    get_user_notification_preferences_parameters()   X-Ref
    Returns description of method parameters

    return: external_function_parameters

    get_user_notification_preferences($userid = 0)   X-Ref
    Get the notification preferences for a given user.

    return: external_description
    param: int $userid id of the user, 0 for current user

    get_user_notification_preferences_returns()   X-Ref
    Returns description of method result value

    return: external_description

    get_user_message_preferences_parameters()   X-Ref
    Returns description of method parameters

    return: external_function_parameters

    get_user_message_preferences($userid = 0)   X-Ref
    Get the notification preferences for a given user.

    return: external_description
    param: int $userid id of the user, 0 for current user

    get_user_message_preferences_returns()   X-Ref
    Returns description of method result value

    return: external_description

    set_favourite_conversations_parameters()   X-Ref
    Returns description of method parameters for the favourite_conversations() method.

    return: external_function_parameters

    set_favourite_conversations(int $userid, array $conversationids)   X-Ref
    Favourite a conversation, or list of conversations for a user.

    return: array
    param: int $userid the id of the user, or 0 for the current user.
    param: array $conversationids the list of conversations ids to favourite.

    set_favourite_conversations_returns()   X-Ref
    Return a description of the returns for the create_user_favourite_conversations() method.

    return: external_description

    unset_favourite_conversations_parameters()   X-Ref
    Returns description of method parameters for unfavourite_conversations() method.

    return: external_function_parameters

    unset_favourite_conversations(int $userid, array $conversationids)   X-Ref
    Unfavourite a conversation, or list of conversations for a user.

    return: array
    param: int $userid the id of the user, or 0 for the current user.
    param: array $conversationids the list of conversations ids unset as favourites.

    unset_favourite_conversations_returns()   X-Ref
    Unset favourite conversations return description.

    return: external_description

    get_member_info_parameters()   X-Ref
    Returns description of method parameters for get_member_info() method.

    return: external_function_parameters

    get_member_info(int $referenceuserid,array $userids,bool $includecontactrequests = false,bool $includeprivacyinfo = false)   X-Ref
    Returns conversation member info for the supplied users, relative to the supplied referenceuserid.

    This is the basic structure used when returning members, and includes information about the relationship between each member
    and the referenceuser, such as a whether the referenceuser has marked the member as a contact, or has blocked them.

    return: array the array of objects containing member info.
    param: int $referenceuserid the id of the user which check contact and blocked status.
    param: array $userids

    get_member_info_returns()   X-Ref
    Get member info return description.

    return: external_description

    get_conversation_counts_parameters()   X-Ref
    Returns description of method parameters for get_conversation_counts() method.

    return: external_function_parameters

    get_conversation_counts(int $userid)   X-Ref
    Returns an array of conversation counts for the various types of conversations, including favourites.

    Return format:
    [
    'favourites' => 0,
    'types' => [
    \core_message\api::MESSAGE_CONVERSATION_TYPE_INDIVIDUAL => 0,
    \core_message\api::MESSAGE_CONVERSATION_TYPE_GROUP => 0
    ]
    ]

    return: array the array of conversation counts, indexed by type.
    param: int $userid the id of the user whose counts we are fetching.

    get_conversation_counts_returns()   X-Ref
    Get conversation counts return description.

    return: external_description

    get_unread_conversation_counts_parameters()   X-Ref
    Returns description of method parameters for get_unread_conversation_counts() method.

    return: external_function_parameters

    get_unread_conversation_counts(int $userid)   X-Ref
    Returns an array of unread conversation counts for the various types of conversations, including favourites.

    Return format:
    [
    'favourites' => 0,
    'types' => [
    \core_message\api::MESSAGE_CONVERSATION_TYPE_INDIVIDUAL => 0,
    \core_message\api::MESSAGE_CONVERSATION_TYPE_GROUP => 0
    ]
    ]

    return: array the array of unread conversation counts, indexed by type.
    param: int $userid the id of the user whose counts we are fetching.

    get_unread_conversation_counts_returns()   X-Ref
    Get unread conversation counts return description.

    return: external_description

    delete_message_for_all_users_parameters()   X-Ref
    Returns description of method parameters

    return: external_function_parameters

    delete_message_for_all_users(int $messageid, int $userid)   X-Ref
    Deletes a message for all users

    return: external_description
    param: int $messageid the message id
    param: int $userid the user id of who we want to delete the message for all users

    delete_message_for_all_users_returns()   X-Ref
    Returns description of method result value

    return: external_description