Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
// This file is part of Moodle - http://moodle.org/
2
//
3
// Moodle is free software: you can redistribute it and/or modify
4
// it under the terms of the GNU General Public License as published by
5
// the Free Software Foundation, either version 3 of the License, or
6
// (at your option) any later version.
7
//
8
// Moodle is distributed in the hope that it will be useful,
9
// but WITHOUT ANY WARRANTY; without even the implied warranty of
10
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
// GNU General Public License for more details.
12
//
13
// You should have received a copy of the GNU General Public License
14
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
15
 
16
/**
17
 * Repository to perform WS calls for mod_bigbluebuttonbn.
18
 *
19
 * @module      mod_bigbluebuttonbn/repository
20
 * @copyright   2021 Blindside Networks Inc
21
 * @license     http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
22
 */
23
 
24
import {call as fetchMany} from 'core/ajax';
25
 
26
/**
27
 * Fetch the list of recordings from the server.
28
 *
29
 * @param   {Number} bigbluebuttonbnid The instance ID
30
 * @param   {String} tools the set of tools to display
31
 * @param   {number} groupid
32
 * @returns {Promise}
33
 */
34
export const fetchRecordings = (bigbluebuttonbnid, tools, groupid) => {
35
    const args = {
36
        bigbluebuttonbnid,
37
        tools,
38
    };
39
 
40
    if (groupid) {
41
        args.groupid = groupid;
42
    }
43
 
44
    return fetchMany([{methodname: 'mod_bigbluebuttonbn_get_recordings', args}])[0];
45
};
46
 
47
/**
48
 * Fetch the list of recordings from the server that can be imported.
49
 *
50
 * @param   {Number} destinationinstanceid The destination instance ID
51
 * @param   {Number} sourcebigbluebuttonbnid The original instance ID
52
 * @param   {Number} sourcecourseid The destination instance ID
53
 * @param   {String} tools the set of tools to display
54
 * @param   {number} groupid
55
 * @returns {Promise}
56
 */
57
export const fetchRecordingsToImport = (
58
    destinationinstanceid,
59
    sourcebigbluebuttonbnid,
60
    sourcecourseid,
61
    tools,
62
    groupid
63
) => {
64
    const args = {
65
        destinationinstanceid,
66
        sourcebigbluebuttonbnid,
67
        sourcecourseid,
68
        tools,
69
    };
70
 
71
    if (groupid) {
72
        args.groupid = groupid;
73
    }
74
 
75
    return fetchMany([{methodname: 'mod_bigbluebuttonbn_get_recordings_to_import', args}])[0];
76
};
77
 
78
/**
79
 * Perform an update on a single recording.
80
 *
81
 * @param   {object} args The instance ID
82
 * @returns {Promise}
83
 */
84
export const updateRecording = args => fetchMany([
85
    {
86
        methodname: 'mod_bigbluebuttonbn_update_recording',
87
        args,
88
    }
89
])[0];
90
 
91
/**
92
 * End the Meeting
93
 *
94
 * @param {number} bigbluebuttonbnid
95
 * @param {number} groupid
96
 * @returns {Promise}
97
 */
98
export const endMeeting = (bigbluebuttonbnid, groupid) => fetchMany([
99
    {
100
        methodname: 'mod_bigbluebuttonbn_end_meeting',
101
        args: {
102
            bigbluebuttonbnid,
103
            groupid
104
        },
105
    }
106
])[0];
107
 
108
/**
109
 * Validate completion.
110
 *
111
 * @param {number} bigbluebuttonbnid
112
 * @returns {Promise}
113
 */
114
export const completionValidate = (bigbluebuttonbnid) => fetchMany([
115
    {
116
        methodname: 'mod_bigbluebuttonbn_completion_validate',
117
        args: {
118
            bigbluebuttonbnid
119
        },
120
    }
121
])[0];
122
 
123
 
124
/**
125
 * Fetch meeting info for the specified meeting.
126
 *
127
 * @param {number} bigbluebuttonbnid
128
 * @param {number} groupid
129
 * @param {boolean} [updatecache=false]
130
 * @returns {Promise}
131
 */
132
export const getMeetingInfo = (bigbluebuttonbnid, groupid, updatecache = false) => fetchMany([
133
    {
134
        methodname: 'mod_bigbluebuttonbn_meeting_info',
135
        args: {
136
            bigbluebuttonbnid,
137
            groupid,
138
            updatecache,
139
        },
140
    }
141
])[0];