UNPKG

@councilbox/shutter-js

Version:

Shutter API - javascript SDK

68 lines (58 loc) 925 B
const { getOperationName } = require('./utils'); const ADD_EVENT = ` mutation addEvent($event: EventInfo!) { addEvent(event: $event) { id type roomNumber attendeeID date ip platform { osName osVersion browserName browserVersion userAgent } audioSource videoSource audioDevices { deviceId label kind groupId } videoDevices { deviceId label kind groupId } peerID displayName error reason content old } } `; module.exports = class Events { #shutterFetch constructor(shutterFetch) { this.#shutterFetch = shutterFetch; } async create(event) { const variables = { event }; const response = await this.#shutterFetch({ query: ADD_EVENT, variables, operationName: getOperationName(ADD_EVENT) }); if (response.errors) throw response.errors; return response.data.addEvent; } };