UNPKG

mindbody-api-v6

Version:

Type safe library for interacting with Mindbody's Public API (v6) and Webhooks

1,017 lines (994 loc) 30.3 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var axios = require('axios'); var pLimit = require('p-limit'); let CONFIG = {}; let FULL_CREDENTIALS_PROVIDED = false; class Config { constructor() { } static setup(config) { CONFIG = config; if (config.username != null && config.password != null) { FULL_CREDENTIALS_PROVIDED = true; } } static getApiKey() { if (CONFIG.apiKey == null) { throw Error('Config.setup({ apiKey: <key> }) requires at least an API key to interact with endpoints'); } return CONFIG.apiKey; } static get() { if (CONFIG.username == null || CONFIG.password == null || CONFIG.apiKey == null) { throw Error('Config.setup({...}) requires all fields to be provided to generate a staff token'); } return CONFIG; } static isFullCredentialsProvided() { return FULL_CREDENTIALS_PROVIDED; } } class MindbodyError extends Error { constructor(errorResponse) { super(); if (Object.keys(errorResponse).includes('errors')) { const error = errorResponse; this.code = error.errors.map(e => e.errorType); this.message = error.errors .map(e => e.errorMessage) .join('. ') .trim(); return; } const error = errorResponse; this.code = error.Error.Code; this.message = error.Error.Message; } } const tokenCache = {}; function set(key, value) { tokenCache[key] = value; } function get(key) { const cacheValue = tokenCache[key]; if (cacheValue != null && cacheValue.expirationDate > new Date(Date.now())) { return cacheValue; } return null; } const API_BASE_URL = 'https://api.mindbodyonline.com/public/v6'; const WEBHOOKS_BASE_URL = 'https://mb-api.mindbodyonline.com/push/api/v1'; const TWENTY_FOUR_HOURS = 3600 * 1000 * 24; class BaseClient { constructor(clientType) { this.client = axios.create({ baseURL: clientType === 'api-client' ? API_BASE_URL : WEBHOOKS_BASE_URL, }); this.client.interceptors.response.use(res => res, err => { var _a, _b; if (err instanceof axios.AxiosError && ((_a = err.response) === null || _a === void 0 ? void 0 : _a.data) != null) { const serverErrorMessage = (_b = err.response.data) === null || _b === void 0 ? void 0 : _b.Message; if (serverErrorMessage != null) { throw new Error('Mindbody Internal Server Error: ' + serverErrorMessage); } const error = err.response.data; throw new MindbodyError(error); } throw new Error('Unknown error'); }); } async request(siteID) { const headers = Config.isFullCredentialsProvided() ? await this.authHeaders(siteID) : this.basicHeaders(siteID); return [this.client, headers]; } webhookRequest() { return [this.client, this.basicHeaders()]; } basicHeaders(siteID) { const headers = { 'Content-Type': 'application/json', 'Api-Key': Config.getApiKey(), }; if (siteID != null) { headers.SiteId = siteID; } return headers; } async authHeaders(siteID) { const staffToken = await this.getStaffToken(siteID); return { ...this.basicHeaders(siteID), Authorization: 'Bearer ' + staffToken, }; } async getStaffToken(siteID) { const cacheKey = `site_id:${siteID}`; const cachedToken = get(cacheKey); if (cachedToken != null) { return cachedToken.token; } const config = Config.get(); const res = await this.client.post('/usertoken/issue', { Username: config.username, Password: config.password, }, { headers: this.basicHeaders(siteID), }); set(cacheKey, { token: res.data.AccessToken, expirationDate: new Date(Date.now() + TWENTY_FOUR_HOURS), }); return res.data.AccessToken; } } async function autoPager(args) { const allResults = [args.firstPage[args.objectIndexKey]].flat(); const totalResults = args.firstPage.PaginationResponse.TotalResults; const limit = args.firstPage.PaginationResponse.RequestedLimit; const requestCount = Math.floor(totalResults / limit); const requests = []; const pl = pLimit(100); for (let i = 1; i < requestCount; i++) { const offset = limit * i; requests.push(pl(() => args.client.get(args.endpoint, { headers: args.headers, params: { ...args.params, Offset: offset, Limit: limit, }, }))); if (i === requestCount - 1) { requests.push(pl(() => args.client.get(args.endpoint, { headers: args.headers, params: { ...args.params, Offset: requestCount === 1 ? limit : offset + limit, Limit: limit, }, }))); } } const responses = await Promise.all(requests); responses.forEach(res => { const paginatedResponse = res.data; const data = paginatedResponse[args.objectIndexKey]; allResults.push(...data); }); return { PaginationResponse: { TotalResults: allResults.length, RequestedLimit: allResults.length, RequestedOffset: 0, PageSize: allResults.length, }, [args.objectIndexKey]: allResults, }; } var _a$1; class MindbodyAPIClient extends BaseClient { constructor() { super('api-client'); } static get() { var _b; return (_b = this.instance) !== null && _b !== void 0 ? _b : (this.instance = new this()); } async get(endpoint, args) { const [client, headers] = await this.request(args.siteID); const res = await client(endpoint, { method: 'GET', headers, params: args.params, }); return res.data; } async getPaginated(endpoint, args) { const [client, headers] = await this.request(args.siteID); const res = await client(endpoint, { method: 'GET', headers, params: args.params, }); if (args.autoPaginate) { return await autoPager({ client: client, endpoint: endpoint, headers: headers, firstPage: res.data, objectIndexKey: args.objectIndexKey, params: args.params, }); } return res.data; } async post(endpoint, args) { const [client, headers] = await this.request(args.siteID); const res = await client(endpoint, { method: 'POST', headers, data: args.payload, }); return res.data; } async put(endpoint, args) { const [client, headers] = await this.request(args.siteID); const res = await client(endpoint, { method: 'PUT', headers, data: args.payload, }); return res.data; } async delete(endpoint, args) { const [client, headers] = await this.request(args.siteID); const res = await client.delete(endpoint, { method: 'DELETE', headers, params: args.params, }); return res.status === 204; } } _a$1 = MindbodyAPIClient; MindbodyAPIClient.instance = new _a$1(); const MINDBODY$9 = MindbodyAPIClient.get(); async function getActiveSessionTimes(args) { return await MINDBODY$9.getPaginated('/appointment/activesessiontimes', { ...args, objectIndexKey: 'ActiveSessionTimes', }); } async function getAppointmentAddOns(args) { return await MINDBODY$9.getPaginated('/appointment/addons', { ...args, objectIndexKey: 'AddOnds', }); } async function getAppointmentAvailableDates(args) { return await MINDBODY$9.get('/appointment/availabledates', args); } async function getAppointmentOptions(args) { return await MINDBODY$9.get('/appointment/appointmentoptions', args); } async function getBookableItems(args) { return await MINDBODY$9.getPaginated('/appointment/bookableitems', { ...args, objectIndexKey: 'Availabilities', }); } async function getScheduleItems(args) { return await MINDBODY$9.getPaginated('/appointment/scheduleitems', { ...args, objectIndexKey: 'StaffMembers', }); } async function getStaffAppointments(args) { return await MINDBODY$9.getPaginated('/appointment/staffappointments', { ...args, objectIndexKey: 'Appointments', }); } async function addAppointment(args) { return await MINDBODY$9.post('/appointment/addappointment', args); } async function addAppointmentAddOn(args) { return await MINDBODY$9.post('/appointment/addappointmentaddon', args); } async function updateAppointment(args) { return await MINDBODY$9.post('/appointment/updateappointment', args); } async function addAvailabilities(args) { return await MINDBODY$9.post('/appointment/availabilities', args); } async function updateAvailabilities(args) { return await MINDBODY$9.put('/appointment/availabilities', args); } async function deleteAppointmentAddOn(args) { await MINDBODY$9.delete('/appointment/deleteappointmentaddon', args); } async function deleteAvailability(args) { await MINDBODY$9.delete('/appointment/availability', args); } async function removeFromAppointmentWaitlist(args) { await MINDBODY$9.delete('/appointment/removefromappointmentwaitlist', args); } var Appointment = { getActiveSessionTimes, getAppointmentAddOns, getAppointmentAvailableDates, getAppointmentOptions, getBookableItems, getStaffAppointments, getScheduleItems, addAppointment, addAppointmentAddOn, addAvailabilities, updateAppointment, updateAvailabilities, deleteAvailability, deleteAppointmentAddOn, removeFromAppointmentWaitlist, }; const MINDBODY$8 = MindbodyAPIClient.get(); async function getClasses(args) { return await MINDBODY$8.getPaginated('/class/classes', { ...args, objectIndexKey: 'Classes', }); } async function getClassDescriptions(args) { return await MINDBODY$8.getPaginated('/class/classdescriptions', { ...args, objectIndexKey: 'ClassDescriptions', }); } async function getClassSchedules(args) { return await MINDBODY$8.getPaginated('/class/classschedules', { ...args, objectIndexKey: 'ClassSchedules', }); } async function getClassVisits(args) { return await MINDBODY$8.get('/class/classvisits', args); } async function getCourses(args) { return await MINDBODY$8.getPaginated('/class/courses', { ...args, objectIndexKey: 'Courses', }); } async function getWaitlistEntries(args) { return await MINDBODY$8.getPaginated('/class/waitlistentries', { ...args, objectIndexKey: 'WaitlistEntries', }); } async function getSemesters(args) { return await MINDBODY$8.getPaginated('/class/semesters', { ...args, objectIndexKey: 'Semesters', }); } async function addClientToClass(args) { return await MINDBODY$8.post('/class/addclienttoclass', args); } async function removeClientFromClass(args) { return await MINDBODY$8.post('/class/removeclientfromclass', args); } async function removeClientsFromClasses(args) { return await MINDBODY$8.post('/class/removeclientsfromclasses', args); } async function removeFromWaitlist(args) { await MINDBODY$8.post('/class/removefromwaitlist', args); } async function substituteClassTeacher(args) { return await MINDBODY$8.post('/class/substituteclassteacher', args); } async function cancelSingleClass(args) { return await MINDBODY$8.post('/class/cancelsingleclass', args); } var Class = { getClasses, getClassDescriptions, getClassSchedules, getClassVisits, getCourses, getWaitlistEntries, getSemesters, addClientToClass, removeClientFromClass, removeClientsFromClasses, removeFromWaitlist, cancelSingleClass, substituteClassTeacher, }; const MINDBODY$7 = MindbodyAPIClient.get(); async function getActiveClientMemberships(args) { return await MINDBODY$7.getPaginated('/client/activeclientmemberships', { ...args, objectIndexKey: 'ClientMemberships', }); } async function getActiveClientsMemberships(args) { return await MINDBODY$7.getPaginated('/client/activeclientsmemberships', { ...args, objectIndexKey: 'ClientMemberships', }); } async function getClientAccountBalances(args) { return await MINDBODY$7.getPaginated('/client/clientaccountbalances', { ...args, objectIndexKey: 'Clients', }); } async function getContactLogs(args) { return await MINDBODY$7.getPaginated('/client/contactlogs', { ...args, objectIndexKey: 'ContactLogs', }); } async function getClientContracts(args) { return await MINDBODY$7.getPaginated('/client/clientcontracts', { ...args, objectIndexKey: 'Contracts', }); } async function getClientDirectDebitInfo(args) { return await MINDBODY$7.get('/client/clientdirectdebitinfo', args); } async function getClientDuplicates(args) { return await MINDBODY$7.getPaginated('/client/clientduplicates', { ...args, objectIndexKey: 'ClientDuplicates', }); } async function getClientFormulaNotes(args) { return await MINDBODY$7.get('/client/clientformulanotes', args); } async function getClientIndexes(args) { return await MINDBODY$7.get('/client/clientindexes', args); } async function getClientPurchases(args) { return await MINDBODY$7.getPaginated('/client/clientpurchases', { ...args, objectIndexKey: 'Purchases', }); } async function getClientReferralTypes(args) { return await MINDBODY$7.get('/client/clientreferraltypes', args); } async function getClientRewards(args) { return await MINDBODY$7.getPaginated('/client/clientrewards', { ...args, objectIndexKey: 'Transactions', }); } async function getClients(args) { return await MINDBODY$7.getPaginated('/client/clients', { ...args, objectIndexKey: 'Clients', }); } async function getClientCompleteInfo(args) { return await MINDBODY$7.get('/client/clientcompleteinfo', args); } async function getClientServices(args) { return await MINDBODY$7.getPaginated('/client/clientservices', { ...args, objectIndexKey: 'ClientServices', }); } async function getClientVisits(args) { return await MINDBODY$7.getPaginated('/client/clientvisits', { ...args, objectIndexKey: 'Visits', }); } async function getClientSchedule(args) { return await MINDBODY$7.get('/client/clientschedule', args); } async function getCrossRegionalClientAssociations(args) { return await MINDBODY$7.getPaginated('/client/crossregionalclientassociations', { ...args, objectIndexKey: 'CrossRegionalClientAssociations', }); } async function getCustomClientFields(args) { return await MINDBODY$7.getPaginated('/client/customclientfields', { ...args, objectIndexKey: 'CustomClientFields', }); } async function getRequiredClientFields(args) { return await MINDBODY$7.get('/client/requiredclientfields', args); } async function getContactLogTypes(args) { return await MINDBODY$7.getPaginated('/client/contactlogtypes', { ...args, objectIndexKey: 'ContactLogTypes', }); } async function addArival(args) { return await MINDBODY$7.post('/client/addarrival', args); } async function addClient(args) { return await MINDBODY$7.post('/client/addclient', args); } async function addClientDirectDebitInfo(args) { return await MINDBODY$7.post('/client/addclientdirectdebitinfo', args); } async function addClientFormulaNote(args) { return await MINDBODY$7.post('/client/addclientformulanote', args); } async function addContactLog(args) { return await MINDBODY$7.post('/client/addcontactlog', args); } async function sendAutoEmail(args) { await MINDBODY$7.post('/client/sendautoemail', args); } async function sendPasswordResetEmail(args) { await MINDBODY$7.post('/client/sendpasswordresetemail', args); } async function terminateContract(args) { return await MINDBODY$7.post('/client/terminatecontract', args); } async function updateClient(args) { return await MINDBODY$7.post('/client/updateclient', args); } async function updateClientRewards(args) { return await MINDBODY$7.post('/client/clientrewards', args); } async function updateClientService(args) { return await MINDBODY$7.post('/client/updateclientservice', args); } async function updateClientVisit(args) { return await MINDBODY$7.post('/client/updateclientvisit', args); } async function updateContactLog(args) { return await MINDBODY$7.post('/client/updatecontactlog', args); } async function uploadClientDocument(args) { return await MINDBODY$7.post('/client/uploadclientdocument', args); } async function uploadClientPhoto(args) { return await MINDBODY$7.post('/client/uploadclientphoto', args); } async function deleteClientDirectDebitInfoQ(args) { return await MINDBODY$7.delete('/client/clientdirectdebitinfo', args); } async function deleteClientFormulaNote(args) { return await MINDBODY$7.delete('/client/clientformulanote', args); } async function deleteContactLog(args) { return await MINDBODY$7.delete('/client/deletecontactlog', args); } var Client = { getActiveClientMemberships, getActiveClientsMemberships, getClientAccountBalances, getClientCompleteInfo, getClientContracts, getClientDirectDebitInfo, getClientDuplicates, getClientFormulaNotes, getClientIndexes, getClientSchedule, getClientReferralTypes, getClientPurchases, getClientRewards, getClients, getClientServices, getClientVisits, getCustomClientFields, getCrossRegionalClientAssociations, getRequiredClientFields, getContactLogs, getContactLogTypes, addArival, addClient, addClientDirectDebitInfo, addClientFormulaNote, addContactLog, sendAutoEmail, sendPasswordResetEmail, updateClient, updateClientRewards, updateClientService, updateClientVisit, updateContactLog, uploadClientDocument, uploadClientPhoto, deleteClientDirectDebitInfoQ, deleteClientFormulaNote, deleteContactLog, terminateContract, }; const MINDBODY$6 = MindbodyAPIClient.get(); async function getEnrollments(args) { return await MINDBODY$6.getPaginated('/enrollment/enrollments', { ...args, objectIndexKey: 'Enrollments', }); } async function addClientToEnrollment(args) { return await MINDBODY$6.post('/enrollment/addclienttoenrollment', args); } var Enrollment = { addClientToEnrollment, getEnrollments, }; const MINDBODY$5 = MindbodyAPIClient.get(); async function getCommissions(args) { return await MINDBODY$5.getPaginated('/payroll/commissions', { ...args, objectIndexKey: 'Commissions', }); } async function getScheduledServiceEarnings(args) { return await MINDBODY$5.getPaginated('/payroll/scheduledserviceearnings', { ...args, objectIndexKey: 'ScheduledServiceEarnings', }); } async function getTimeCards(args) { return await MINDBODY$5.getPaginated('/payroll/timecards', { ...args, objectIndexKey: 'TimeCards', }); } async function getTips(args) { return await MINDBODY$5.getPaginated('/payroll/tips', { ...args, objectIndexKey: 'Tips', }); } var Payroll = { getCommissions, getScheduledServiceEarnings, getTimeCards, getTips, }; const MINDBODY$4 = MindbodyAPIClient.get(); async function getAcceptedCardsTypes(args) { return await MINDBODY$4.get('/sale/acceptedcardtypes', args); } async function getContracts(args) { return await MINDBODY$4.getPaginated('/sale/contracts', { ...args, objectIndexKey: 'Contracts', }); } async function getCustomPaymentMethods(args) { return await MINDBODY$4.get('/sale/custompaymentmethods', args); } async function getGiftCardBalance(args) { return await MINDBODY$4.get('/sale/giftcardbalance', args); } async function getGiftCards(args) { return await MINDBODY$4.getPaginated('/sale/giftcards', { ...args, objectIndexKey: 'GiftCards', }); } async function getPackages(args) { return await MINDBODY$4.getPaginated('/sale/packages', { ...args, objectIndexKey: 'Packages', }); } async function getProducts(args) { return await MINDBODY$4.getPaginated('/sale/products', { ...args, objectIndexKey: 'Products', }); } async function getProductsInventory(args) { return await MINDBODY$4.getPaginated('/sale/productsinventory', { ...args, objectIndexKey: 'ProductsInventory', }); } async function getSales(args) { return await MINDBODY$4.getPaginated('/sale/sales', { ...args, objectIndexKey: 'Sales', }); } async function getServices(args) { return await MINDBODY$4.getPaginated('/sale/services', { ...args, objectIndexKey: 'Services', }); } async function getTransactions(args) { return await MINDBODY$4.getPaginated('/sale/transactions', { ...args, objectIndexKey: 'Transactions', }); } async function checkoutShoppingCart(args) { return await MINDBODY$4.post('/sale/checkoutshoppingcart', args); } async function purchaseAccountCredit(args) { return await MINDBODY$4.post('/sale/purchaseaccountcredit', args); } async function purchaseContract(args) { return await MINDBODY$4.post('/sale/purchasecontract', args); } async function purchaseGiftCard(args) { return await MINDBODY$4.post('/sale/purchasegiftcard', args); } async function updateProductPrice(args) { return await MINDBODY$4.post('/sale/updateproductprice', args); } async function returnSale(args) { return await MINDBODY$4.post('/sale/returnsale', args); } async function initializeCreditCard(args) { return await MINDBODY$4.post('/sale/initializecreditcardentry', args); } async function updateProducts(args) { return await MINDBODY$4.put('/sale/products', args); } async function updateServices(args) { return await MINDBODY$4.put('/sale/services', args); } async function updateSaleDate(args) { return await MINDBODY$4.put('/sale/updatesaledate', args); } var Sale = { getAcceptedCardsTypes, getContracts, getCustomPaymentMethods, getGiftCardBalance, getGiftCards, getPackages, getProducts, getProductsInventory, getSales, getServices, getTransactions, checkoutShoppingCart, initializeCreditCard, purchaseAccountCredit, purchaseContract, purchaseGiftCard, returnSale, updateProducts, updateProductPrice, updateServices, updateSaleDate, }; const MINDBODY$3 = MindbodyAPIClient.get(); async function getActivationCode(args) { return await MINDBODY$3.get('/site/activationcode', args); } async function getGenders(args) { return await MINDBODY$3.getPaginated('/site/genders', { ...args, objectIndexKey: 'GenderOptions', }); } async function getLocations(args) { return await MINDBODY$3.getPaginated('/site/locations', { ...args, objectIndexKey: 'Locations', }); } async function getMemberships(args) { return await MINDBODY$3.get('/site/memberships', args); } async function getPrograms(args) { return await MINDBODY$3.getPaginated('/site/programs', { ...args, objectIndexKey: 'Programs', }); } async function getPromoCodes(args) { return await MINDBODY$3.get('/site/promocodes', args); } async function getResources(args) { return await MINDBODY$3.getPaginated('/site/resources', { ...args, objectIndexKey: 'Resources', }); } async function getSessionTypes(args) { return await MINDBODY$3.getPaginated('/site/sessiontypes', { ...args, objectIndexKey: 'SessionTypes', }); } async function getSites(args) { return await MINDBODY$3.getPaginated('/site/sites', { ...args, objectIndexKey: 'Sites', }); } async function getCategories(args) { return await MINDBODY$3.getPaginated('/site/categories', { ...args, objectIndexKey: 'Categories', }); } async function getPaymentTypes(args) { return await MINDBODY$3.getPaginated('/site/paymenttypes', { ...args, objectIndexKey: 'PaymentTypes', }); } async function getRelationships(args) { return await MINDBODY$3.getPaginated('/site/relationships', { ...args, objectIndexKey: 'Relationships', }); } async function getMobileProviders(args) { return await MINDBODY$3.getPaginated('/site/mobileproviders', { ...args, objectIndexKey: 'MobileProviders', }); } async function getProspectStages(args) { return await MINDBODY$3.getPaginated('/site/prospectstages', { ...args, objectIndexKey: 'ProspectStages', }); } async function addPromoCode(args) { return await MINDBODY$3.post('/site/addpromocode', args); } var Site = { getActivationCode, getCategories, getGenders, getLocations, getMemberships, getMobileProviders, getPaymentTypes, getPrograms, getPromoCodes, getProspectStages, getRelationships, getResources, getSessionTypes, getSites, addPromoCode, }; const MINDBODY$2 = MindbodyAPIClient.get(); async function getStaff(args) { return await MINDBODY$2.getPaginated('/staff/staff', { ...args, objectIndexKey: 'StaffMembers', }); } async function getStaffPermissions(args) { return await MINDBODY$2.get('/staff/staffpermissions', args); } async function getStaffImageURL(args) { return await MINDBODY$2.get('/staff/imageurl', args); } async function getStaffSessionTypes(args) { return await MINDBODY$2.getPaginated('/staff/sessiontypes', { ...args, objectIndexKey: 'StaffSessionTypes', }); } async function getSalesReps(args) { return await MINDBODY$2.get('/staff/salesreps', args); } async function addStaff(args) { return await MINDBODY$2.post('/staff/addstaff', args); } async function addStaffAvailability(args) { await MINDBODY$2.post('/staff/staffavailability', args); } async function assignStaffSessionType(args) { return await MINDBODY$2.post('/staff/assignsessiontype', args); } async function updateStaff(args) { return await MINDBODY$2.post('/staff/updatestaff', args); } async function updateStaffPermissions(args) { return await MINDBODY$2.post('/staff/updatestaffpermissions', args); } var Staff = { getSalesReps, getStaff, getStaffImageURL, getStaffPermissions, getStaffSessionTypes, addStaff, addStaffAvailability, assignStaffSessionType, updateStaff, updateStaffPermissions, }; var _a; class MindbodyWebhooksClient extends BaseClient { constructor() { super('webhooks-client'); } static get() { var _b; return (_b = this.instance) !== null && _b !== void 0 ? _b : (this.instance = new this()); } async get(endpoint) { const [client, headers] = this.webhookRequest(); const res = await client(endpoint, { method: 'GET', headers, }); return res.data; } async post(endpoint, args) { const [client, headers] = this.webhookRequest(); const res = await client(endpoint, { method: 'POST', headers, data: args, }); return res.data; } async patch(endpoint, args) { const [client, headers] = this.webhookRequest(); const res = await client(endpoint, { method: 'PATCH', headers, data: args, }); return res.data; } async delete(endpoint) { const [client, headers] = this.webhookRequest(); const res = await client.delete(endpoint, { method: 'DELETE', headers, }); return res.data; } } _a = MindbodyWebhooksClient; MindbodyWebhooksClient.instance = new _a(); const MINDBODY$1 = MindbodyWebhooksClient.get(); async function getMetrics() { return await MINDBODY$1.get('/metrics'); } var Metrics = { getMetrics }; const MINDBODY = MindbodyWebhooksClient.get(); async function getSubscriptions() { return await MINDBODY.get('/subscriptions'); } async function getSubscription(subscriptionID) { return await MINDBODY.get(`/subscriptions/${subscriptionID}`); } async function createSubscription(args) { return await MINDBODY.post('/subscriptions', args); } async function updateSubscription(subscriptionID, args) { return await MINDBODY.patch(`/subscriptions/${subscriptionID}`, args); } async function deleteSubscription(subscriptionID) { return await MINDBODY.delete(`/subscriptions/${subscriptionID}`); } var Subscriptions = { getSubscriptions, getSubscription, createSubscription, updateSubscription, deleteSubscription, }; var Webhooks = { Metrics, Subscriptions, }; const exports$1 = { Appointment, Class, Client, Config, Enrollment, MindbodyError, Payroll, Sale, Site, Staff, Webhooks, }; exports.Appointment = Appointment; exports.Class = Class; exports.Client = Client; exports.Config = Config; exports.Enrollment = Enrollment; exports.MindbodyError = MindbodyError; exports.Payroll = Payroll; exports.Sale = Sale; exports.Site = Site; exports.Staff = Staff; exports.Webhooks = Webhooks; exports.default = exports$1;