https://github.com/hugodf/uclapi-javascript
JavaScript wrapper for the UCL API
https://github.com/hugodf/uclapi-javascript
api es2015 es6 javascript node
Last synced: about 2 months ago
JSON representation
JavaScript wrapper for the UCL API
- Host: GitHub
- URL: https://github.com/hugodf/uclapi-javascript
- Owner: HugoDF
- License: mit
- Created: 2017-03-02T12:34:15.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-03-07T14:08:15.000Z (over 9 years ago)
- Last Synced: 2025-10-06T16:58:23.268Z (8 months ago)
- Topics: api, es2015, es6, javascript, node
- Language: JavaScript
- Size: 41 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# uclapi
JavaScript wrapper for the UCL API. Works both in the browser and in Node.
## Usage
```js
// ES6 modules
import UclApi from 'uclapi';
// CommonJS
const UclApi = require('uclapi');
// Initialise the API wrapper
const token = 'my-ucl-api-token';
const uclApi = new UclApi({ token });
uclApi.getRooms(/* { options } */)
.then(rooms => {
console.log(rooms);
});
uclApi.getBookings(/* { options } */)
.then(bookings => {
console.log(bookings);
});
uclApi.getEquipment(/* { options } */)
.then(equipment => {
console.log(equipment);
});
```
## API
`UclApi#getRooms`:
- params: (all optional) roomid, roomname, siteid, sitename, classification, capacity
- return: Promise that resolves to an array of room objects
`UclApi#getBookings`:
- params: (all optional) roomid, start\_datetime, end\_datetime, date, siteid, description, contact, results\_per\_page, roomname
- return: Promise that resolves to an array of booking objects
`UclApi#getBookings`:
- params: (all optional) roomid, siteid
- return: Promise that resolves to an array of equipment objects