aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValentin Popov <info@valentineus.link>2018-10-29 01:30:45 +0300
committerValentin Popov <info@valentineus.link>2018-10-29 01:30:45 +0300
commitb8e61c44ac2af52b4b3daa70f32e478e369dc140 (patch)
tree62078192c12c976c9dea2a40953d112e9e26e83e
parent6c31017c8df2aede3d21da1227735ed0e2b8d918 (diff)
downloadlocal_webhooks-b8e61c44ac2af52b4b3daa70f32e478e369dc140.tar.xz
local_webhooks-b8e61c44ac2af52b4b3daa70f32e478e369dc140.zip
External function of getting these services
Signed-off-by: Valentin Popov <info@valentineus.link>
-rw-r--r--externallib.php57
1 files changed, 57 insertions, 0 deletions
diff --git a/externallib.php b/externallib.php
index 010b173..2b43d34 100644
--- a/externallib.php
+++ b/externallib.php
@@ -98,4 +98,61 @@ class local_webhooks_external extends external_api {
)
);
}
+
+ /**
+ * Returns description of method parameters.
+ *
+ * @return \external_function_parameters
+ *
+ * @since Moodle 2.2
+ * @since Moodle 2.9 Options available
+ */
+ public static function get_services_parameters() {
+ return new external_function_parameters(array());
+ }
+
+ /**
+ * Get a list of services.
+ *
+ * @return array
+ *
+ * @since Moodle 2.2
+ * @since Moodle 2.9 Options available
+ *
+ * @throws \dml_exception
+ * @throws \invalid_parameter_exception
+ * @throws \restricted_context_exception
+ */
+ public static function get_services() {
+ $context = context_system::instance();
+ self::validate_context($context);
+
+ return local_webhooks_api::get_services();
+ }
+
+ /**
+ * Returns description of method result value.
+ *
+ * @return \external_multiple_structure
+ *
+ * @since Moodle 2.2
+ * @since Moodle 2.9 Options available
+ */
+ public static function get_services_returns() {
+ return new external_multiple_structure(
+ new external_single_structure(
+ array(
+ 'id' => new external_value(PARAM_INT, 'Service ID.'),
+ 'header' => new external_value(PARAM_RAW, 'Type of outgoing header.'),
+ 'name' => new external_value(PARAM_RAW, 'Name of the service.'),
+ 'point' => new external_value(PARAM_URL, 'Point of delivery of notifications.'),
+ 'status' => new external_value(PARAM_BOOL, 'Current status of the service.'),
+ 'token' => new external_value(PARAM_RAW, 'Token for verification of requests.'),
+ 'events' => new external_multiple_structure(
+ new external_value(PARAM_RAW, 'Event name.'), 'List of events.'
+ ),
+ )
+ )
+ );
+ }
} \ No newline at end of file