UNPKG

rhombus-node-mcp

Version:
76 lines (75 loc) 2.79 kB
import { postApi } from "../network/network.js"; export async function getAllGuestsByOrg(requestModifiers, sessionId) { const res = await postApi({ route: "/guestmanagement/getAllGuestsByOrg", body: {}, modifiers: requestModifiers, sessionId, }); if (res.error) { throw new Error(res.errorMsg ?? "Failed to get guests"); } return (res.allGuests?.map(guest => ({ firstName: guest.firstName ?? undefined, lastName: guest.lastName ?? undefined, email: guest.email ?? undefined, companyName: guest.companyName ?? undefined, locationUuid: guest.locationUuid ?? undefined, hostUserUuid: guest.hostUserUuid ?? undefined, guestType: guest.guestType ?? undefined, checkedInStatus: guest.checkedInEnum ?? undefined, lastCheckedInMs: guest.lastCheckedInMs ?? undefined, lastCheckedOutMs: guest.lastCheckedOutMs ?? undefined, phoneNumber: guest.phoneNumber ?? undefined, })) ?? []); } export async function getGuestActivityLogs(startTimeMs, endTimeMs, requestModifiers, sessionId) { const body = {}; if (startTimeMs) body.createdAfterMs = startTimeMs; if (endTimeMs) body.createdBeforeMs = endTimeMs; const res = await postApi({ route: "/guestmanagement/getGuestActivityLogs", body, modifiers: requestModifiers, sessionId, }); if (res.error) { throw new Error(res.errorMsg ?? "Failed to get guest activity logs"); } return (res.guestActivities?.map(a => ({ activity: a.activity ?? undefined, email: a.email ?? undefined, guestType: a.guestType ?? undefined, locationUuid: a.locationUuid ?? undefined, hostUserUuid: a.hostUserUuid ?? undefined, timestampMs: a.timestampMs ?? undefined, })) ?? []); } export async function getActivitiesForLocation(locationUuid, startTimeMs, endTimeMs, requestModifiers, sessionId) { const body = { locationUuid, }; if (startTimeMs) body.createdAfterMs = startTimeMs; if (endTimeMs) body.createdBeforeMs = endTimeMs; const res = await postApi({ route: "/guestmanagement/getActivitiesForLocation", body, modifiers: requestModifiers, sessionId, }); if (res.error) { throw new Error(res.errorMsg ?? "Failed to get activities for location"); } return (res.guestActivities?.map(a => ({ activity: a.activity ?? undefined, email: a.email ?? undefined, guestType: a.guestType ?? undefined, locationUuid: a.locationUuid ?? undefined, hostUserUuid: a.hostUserUuid ?? undefined, timestampMs: a.timestampMs ?? undefined, })) ?? []); }