Skip to content

Commit

Permalink
ULMS-3113 Moved createEvent to ulms
Browse files Browse the repository at this point in the history
  • Loading branch information
dkvovik committed Jun 24, 2024
1 parent 2838a4f commit 84403d4
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ulms/api-clients",
"version": "7.9.0",
"version": "7.9.1",
"description": "JavaScript API clients for ULMS platform",
"keywords": [],
"homepage": "https://github.com/foxford/ulms-api-clients-js#readme",
Expand Down
2 changes: 2 additions & 0 deletions src/http-event.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ class HTTPEvent extends BasicClient {

/**
* Create event
* @deprecated
* @param {uuid} roomId
* @param {String} type
* @param {Object|String|Number} data
Expand All @@ -131,6 +132,7 @@ class HTTPEvent extends BasicClient {

/**
* Sets the flag "removed" for the event
* @deprecated
* @param {uuid} roomId
* @param {String} type
* @param {Object|String|Number} data
Expand Down
37 changes: 37 additions & 0 deletions src/ulms.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,43 @@ class ULMS extends BasicClient {
)
}

/**
* Create event
* @param {uuid} roomId
* @param {String} type
* @param {Object|String|Number} data
* @param {Object} eventParameters event parameters: attribute, is_claim, is_persistent, label, set, removed
* for more information see: https://github.com/foxford/event/blob/master/docs/src/api/event/create.md
*
* @returns {Promise}
*/
createEvent(roomId, type, data, eventParameters = {}) {
const parameters = {
...eventParameters,
data,
type,
}

return this.post(`${this.baseUrl}/event_rooms/${roomId}/events`, parameters)
}

/**
* Sets the flag "removed" for the event
* @param {uuid} roomId
* @param {String} type
* @param {Object|String|Number} data
* @param {Object} eventParameters event parameters: attribute, is_claim, is_persistent, label, set, removed
* for more information see: https://github.com/foxford/event/blob/master/docs/src/api/event/create.md
*
* @returns {Promise}
*/
createRemovalEvent(roomId, type, data, eventParameters = {}) {
return this.createEvent(roomId, type, data, {
...eventParameters,
removed: true,
})
}

/**
* Perform enter to classroom
* @param {string} classroomId
Expand Down

0 comments on commit 84403d4

Please sign in to comment.