Skip to content

Commit

Permalink
Fix use of new external_api in mobile app external function
Browse files Browse the repository at this point in the history
  • Loading branch information
davosmith committed Feb 2, 2024
1 parent 36385d3 commit 41b3b03
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions classes/external/update_item_state.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,22 @@
global $CFG;
require_once("$CFG->libdir/externallib.php");

use core_external\external_api;
use core_external\external_value;
use core_external\external_function_parameters;
use core_external\external_single_structure;

/**
* External function to update the state of an item in a checklist
*
* @copyright 2023 Davo Smith
* @package mod_checklist
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class update_item_state extends external_api {
class update_item_state extends \external_api {

/**
* Describes the parameters for update_item_state.
*
* @return external_function_parameters
* @return \external_function_parameters
*/
public static function execute_parameters(): external_function_parameters {
return new external_function_parameters(
public static function execute_parameters(): \external_function_parameters {
return new \external_function_parameters(
[
'cmid' => new \external_value(PARAM_INT),
'itemid' => new \external_value(PARAM_INT),
Expand All @@ -56,7 +51,7 @@ public static function execute_parameters(): external_function_parameters {
* @param int $cmid Checklist course module ID.
* @param int $itemid Item ID.
* @param bool $state State to set.
* @return stdClass
* @return \stdClass
*/
public static function execute(int $cmid, int $itemid, bool $state): \stdClass {
global $DB, $PAGE, $USER;
Expand All @@ -78,11 +73,11 @@ public static function execute(int $cmid, int $itemid, bool $state): \stdClass {
/**
* Describes the update_item_state return value.
*
* @return external_single_structure
* @return \external_single_structure
*/
public static function execute_returns(): external_single_structure {
return new external_single_structure([
'status' => new external_value(PARAM_BOOL),
public static function execute_returns(): \external_single_structure {
return new \external_single_structure([
'status' => new \external_value(PARAM_BOOL),
'warnings' => new \external_warnings(),
]);
}
Expand Down

0 comments on commit 41b3b03

Please sign in to comment.