Skip to content

Commit

Permalink
ULMS-3135 Moved listEvent, readRoom, readState to ulms
Browse files Browse the repository at this point in the history
  • Loading branch information
dkvovik committed Jun 26, 2024
1 parent d078ef9 commit e86ca12
Show file tree
Hide file tree
Showing 4 changed files with 47 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.1",
"version": "7.9.2",
"description": "JavaScript API clients for ULMS platform",
"keywords": [],
"homepage": "https://github.com/foxford/ulms-api-clients-js#readme",
Expand Down
3 changes: 3 additions & 0 deletions src/http-event.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class HTTPEvent extends BasicClient {

/**
* Read room
* @deprecated
* @param id
* @returns {Promise}
*/
Expand Down Expand Up @@ -150,6 +151,7 @@ class HTTPEvent extends BasicClient {

/**
* List events
* @deprecated
* @param {uuid} roomId
* @param {Object} filterParameters
* @returns {Promise}
Expand Down Expand Up @@ -189,6 +191,7 @@ class HTTPEvent extends BasicClient {

/**
* Read state
* @deprecated
* @param {uuid} roomId
* @param {String[]} sets
* @param {Object} filterParameters
Expand Down
41 changes: 41 additions & 0 deletions src/ulms.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,25 @@ class ULMS extends BasicClient {
return this.post(`${this.baseUrl}/classrooms/${classroomId}/tokens`)
}

/**
* List events
* @param {uuid} roomId
* @param {Object} filterParameters
* @returns {Promise}
*/
listEvent(roomId, filterParameters = {}) {
return this.get(this.url(`/event_rooms/${roomId}/events`, filterParameters))
}

/**
* Read room
* @param roomId
* @returns {Promise}
*/
readRoom(roomId) {
return this.get(`${this.baseUrl}/event_rooms/${roomId}`)
}

/**
* Read ulms scope
* @param {string} kind
Expand All @@ -157,6 +176,28 @@ class ULMS extends BasicClient {
)
}

/**
* Read state
* @param {uuid} roomId
* @param {String[]} sets
* @param {Object} filterParameters
* @returns {Promise}
*/
readState(roomId, sets, filterParameters = {}) {
// eslint-disable-next-line camelcase
const { attribute, limit, occurred_at, original_occurred_at } =
filterParameters
const parameters = {
attribute,
limit,
occurred_at, // eslint-disable-line camelcase
original_occurred_at, // eslint-disable-line camelcase
sets,
}

return this.get(this.url(`/event_rooms/${roomId}/state`, parameters))
}

/**
* Read class property
* @param {string} kind
Expand Down

0 comments on commit e86ca12

Please sign in to comment.