diff --git a/calendar/amd/build/calendar_repository.min.js b/calendar/amd/build/calendar_repository.min.js
new file mode 100644
index 00000000000..156cad81f20
--- /dev/null
+++ b/calendar/amd/build/calendar_repository.min.js
@@ -0,0 +1 @@
+define(["jquery","core/ajax"],function(a,b){var c=function(a){var c={methodname:"core_calendar_get_calendar_event_by_id",args:{eventid:a}};return b.call([c])[0]};return{getEventById:c}});
\ No newline at end of file
diff --git a/calendar/amd/src/calendar_repository.js b/calendar/amd/src/calendar_repository.js
new file mode 100644
index 00000000000..3e7a68c27d9
--- /dev/null
+++ b/calendar/amd/src/calendar_repository.js
@@ -0,0 +1,50 @@
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see .
+
+/**
+ * A javascript module to handle calendar ajax actions.
+ *
+ * @module core_calendar/calendar_repository
+ * @class repository
+ * @package core_calendar
+ * @copyright 2017 Simey Lameze
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+define(['jquery', 'core/ajax'], function($, Ajax) {
+
+
+ /**
+ * Get a calendar event by id.
+ *
+ * @method getEventById
+ * @param {int} eventId The event id.
+ * @return {promise} Resolved with requested calendar event
+ */
+ var getEventById = function(eventId) {
+
+ var request = {
+ methodname: 'core_calendar_get_calendar_event_by_id',
+ args: {
+ eventid: eventId
+ }
+ };
+
+ return Ajax.call([request])[0];
+ };
+
+ return {
+ getEventById: getEventById
+ };
+});