Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

Differences Between: [Versions 310 and 403] [Versions 311 and 403] [Versions 39 and 403] [Versions 400 and 403] [Versions 401 and 403] [Versions 402 and 403]

   1  <?php
   2  // This file is part of Moodle - http://moodle.org/
   3  //
   4  // Moodle is free software: you can redistribute it and/or modify
   5  // it under the terms of the GNU General Public License as published by
   6  // the Free Software Foundation, either version 3 of the License, or
   7  // (at your option) any later version.
   8  //
   9  // Moodle is distributed in the hope that it will be useful,
  10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12  // GNU General Public License for more details.
  13  //
  14  // You should have received a copy of the GNU General Public License
  15  // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
  16  
  17  /**
  18   * Chat external functions and service definitions.
  19   *
  20   * @package    mod_chat
  21   * @category   external
  22   * @copyright  2015 Juan Leyva <juan@moodle.com>
  23   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  24   * @since      Moodle 3.0
  25   */
  26  
  27  defined('MOODLE_INTERNAL') || die;
  28  
  29  $functions = array(
  30  
  31      'mod_chat_login_user' => array(
  32          'classname'     => 'mod_chat_external',
  33          'methodname'    => 'login_user',
  34          'description'   => 'Log a user into a chat room in the given chat.',
  35          'type'          => 'write',
  36          'capabilities'  => 'mod/chat:chat',
  37          'services'      => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
  38      ),
  39  
  40      'mod_chat_get_chat_users' => array(
  41          'classname'     => 'mod_chat_external',
  42          'methodname'    => 'get_chat_users',
  43          'description'   => 'Get the list of users in the given chat session.',
  44          'type'          => 'read',
  45          'capabilities'  => 'mod/chat:chat',
  46          'services'      => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
  47      ),
  48  
  49      'mod_chat_send_chat_message' => array(
  50          'classname'     => 'mod_chat_external',
  51          'methodname'    => 'send_chat_message',
  52          'description'   => 'Send a message on the given chat session.',
  53          'type'          => 'write',
  54          'capabilities'  => 'mod/chat:chat',
  55          'services'      => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
  56      ),
  57  
  58      'mod_chat_get_chat_latest_messages' => array(
  59          'classname'     => 'mod_chat_external',
  60          'methodname'    => 'get_chat_latest_messages',
  61          'description'   => 'Get the latest messages from the given chat session.',
  62          'type'          => 'read',
  63          'capabilities'  => 'mod/chat:chat',
  64          'services'      => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
  65      ),
  66  
  67      'mod_chat_view_chat' => array(
  68          'classname'     => 'mod_chat_external',
  69          'methodname'    => 'view_chat',
  70          'description'   => 'Trigger the course module viewed event and update the module completion status.',
  71          'type'          => 'write',
  72          'capabilities'  => 'mod/chat:chat',
  73          'services'      => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
  74      ),
  75  
  76      'mod_chat_get_chats_by_courses' => array(
  77          'classname'     => 'mod_chat_external',
  78          'methodname'    => 'get_chats_by_courses',
  79          'description'   => 'Returns a list of chat instances in a provided set of courses,
  80                              if no courses are provided then all the chat instances the user has access to will be returned.',
  81          'type'          => 'read',
  82          'capabilities'  => '',
  83          'services'      => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
  84      ),
  85      'mod_chat_get_sessions' => array(
  86          'classname'     => 'mod_chat_external',
  87          'methodname'    => 'get_sessions',
  88          'description'   => 'Retrieves chat sessions for a given chat.',
  89          'type'          => 'read',
  90          'services'      => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
  91      ),
  92      'mod_chat_get_session_messages' => array(
  93          'classname'     => 'mod_chat_external',
  94          'methodname'    => 'get_session_messages',
  95          'description'   => 'Retrieves messages of the given chat session.',
  96          'type'          => 'read',
  97          'services'      => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
  98      ),
  99  
 100      'mod_chat_view_sessions' => [
 101          'classname'     => 'mod_chat\external\view_sessions',
 102          'methodname'    => 'execute',
 103          'description'   => 'Trigger the chat session viewed event.',
 104          'type'          => 'write',
 105          'capabilities'  => 'mod/chat:readlog',
 106          'services'      => [MOODLE_OFFICIAL_MOBILE_SERVICE]
 107      ],
 108  );