slotify-sdk
v1.0.3
Published
JavaScript SDK for Slotify scheduling API, providing easy-to-use endpoints for scheduling, booking, and managing appointments.
Downloads
20
Maintainers
Readme
Slotify Javascript SDK
The Slotify SDK is a TypeScript-based API client designed to simplify interactions with the Slotify scheduling app API. It provides a flexible and easy-to-use interface for making HTTP requests, managing configurations, and handling API responses, tailored specifically for Slotify's scheduling features.
Dependencies
The following libraries are bundled together with the SDK:
- axios - a promise-based HTTP client for the browser (using XMLHttpRequests) and node.js (using http)
Features
- Configurable Base URL and API Version: Easily set the base URL, API version, and other global configurations.
- CRUD Operations: Perform Create, Read, Update, and Delete operations on Slotify resources like bookings.
- Method Chaining: Chain methods for building complex queries with ease.
- Include Related Data: Fetch related data (e.g., users, events) with a single request.
- Built-in Axios Integration: Powered by Axios for handling HTTP requests.
Installation
The library is hosted on NPM, so you can simply run:
# using npm
npm install slotify-sdk
# using yarn
yarn add slotify-sdk
# using bun
bun add slotify-sdk
Module loading
Using api key, you can access app level data only. You can not use same key for multiple apps.
import SlotifyAPI from 'slotify-sdk';
const slotifyApi = new SlotifyAPI({
apiKey: '8c99a81c-dcbb-4de3-b316-f43b8a902cae',
});
Usage (endpoints)
Documentation : https://slotify.ca/api
Endpoints/methods:
// app endpoints
slotifyApi.getApps(params: any): Promise<any>;
// customer endpoints
slotifyApi.getCustomers(): Promise<any>;
slotifyApi.getCustomer(uuid: string): Promise<any>;
slotifyApi.createCustomer(params: any): Promise<any>;
slotifyApi.deleteCustomer(uuid: string): Promise<any>;
slotifyApi.updateCustomer(uuid: string, params?: any): Promise<any>;
// groups endpoints
slotifyApi.getGroups(): Promise<any>;
slotifyApi.getGroup(uuid: string): Promise<any>;
slotifyApi.createGroup(params: any): Promise<any>;
slotifyApi.deleteGroup(uuid: string): Promise<any>;
slotifyApi.updateGroup(uuid: string, params?: any): Promise<any>;
// resource endpoints
slotifyApi.getResources(): Promise<any>;
slotifyApi.getResource(uuid: string): Promise<any>;
slotifyApi.createResource(params: any): Promise<any>;
slotifyApi.deleteResource(uuid: string): Promise<any>;
slotifyApi.updateResource(uuid: string, params?: any): Promise<any>;
// scheduler endpoints
slotifyApi.getSchedulers(): Promise<any>;
slotifyApi.getScheduler(uuid: string): Promise<any>;
slotifyApi.createScheduler(params: any): Promise<any>;
slotifyApi.deleteScheduler(uuid: string): Promise<any>;
slotifyApi.updateScheduler(uuid: string, params?: any): Promise<any>;
// booking endpoints
slotifyApi.getBookings(): Promise<any>;
slotifyApi.getBooking(uuid: string): Promise<any>;
slotifyApi.createBooking(params: any): Promise<any>;
slotifyApi.deleteBooking(uuid: string): Promise<any>;
slotifyApi.updateBooking(uuid: string, params?: any): Promise<any>;
// booking actions endpoints
slotifyApi.completeBooking(uuid: string): Promise<any>;
slotifyApi.bookCustomer(uuid: string, params: any): Promise<any>;
slotifyApi.confirmBooking(uuid: string, params: any): Promise<any>;
slotifyApi.declineBooking(uuid: string, params: any): Promise<any>;
slotifyApi.reassignBooking(uuid: string, params: any): Promise<any>;
slotifyApi.cancelBookingByCustomer(uuid: string, params: any): Promise<any>;
slotifyApi.cancelBookingByResource(uuid: string, params: any): Promise<any>;
slotifyApi.rescheduleBookingByCustomer(uuid: string, params: any): Promise<any>;
// event endpoints
slotifyApi.getEvents(): Promise<any>;
slotifyApi.getEvent(uuid: string): Promise<any>;
slotifyApi.createEvent(params: any): Promise<any>;
slotifyApi.deleteEvent(uuid: string): Promise<any>;
slotifyApi.updateEvent(uuid: string, params?: any): Promise<any>;
// service endpoints
slotifyApi.getServices(): Promise<any>;
slotifyApi.getService(uuid: string): Promise<any>;
slotifyApi.createService(params: any): Promise<any>;
slotifyApi.deleteService(uuid: string): Promise<any>;
slotifyApi.updateService(uuid: string, params?: any): Promise<any>;
// workflow endpoints
slotifyApi.getWorkflows(): Promise<any>;
slotifyApi.getWorkflow(uuid: string): Promise<any>;
slotifyApi.createWorkflow(params: any): Promise<any>;
slotifyApi.deleteWorkflow(uuid: string): Promise<any>;
slotifyApi.updateWorkflow(uuid: string, params?: any): Promise<any>;
// availability endpoints
slotifyApi.getAvailability(params: any): Promise<any>;
slotifyApi.getUnAvailability(params: any): Promise<any>;
slotifyApi.getAvailabilityCount(params: any): Promise<any>;
Usage (dynamic includes)
Slotify supports dynamic includes
Example:
slotifyApi
.include('customers', 'resources')
.getBookings()
.then(function (response) {
console.log(response);
});
Usage (query params)
If you want to use query params you can use it as below example. Check doc for more advance usage for search parameters.
Example:
slotifyApi
.queryParams({
limit: 10,
search: 'name~:john',
})
.getCustomers()
.then(function (response) {
console.log(response);
});