0.1.0 • Published 10 years ago
fullslate v0.1.0
FullSlate API wrapper
A simple FullSlate API wrapper written in JavaScript (ES6).
Install
$ npm install fullslateUsage
To use this library, you will need a valid FullSlate API token and key. Based off of the FAQ, to obtain an API token you have to contact their support and the key is usually your FullSlate subdomain (e.g. mycompany.fullslate.com, mycompany would be your key).
All API requests return a Promise, Promise rejections will occur from API failures, missing tokens, and/or bad API calls. Not all API calls require an API token though, see the documentation below.
import FullSlate from 'fullslate';
// Initialize the FullSlate wrapper
const fsapi = new FullSlate({
key: 'Your_FullSlate_key'
token: 'Your_FullSlate_API_token'
});
// Get a list of your employees
fsapi.employees()
.then(employees => {
console.log(employees);
})
.catch(err => {
console.error(err);
})Implemented APIs
- Employees
- Services
- Openings
- Cross-realm Openings
- Bookings
- Clients
- Events
- Products
- Vouchers
- Company Configuration
API
employees([id])
id(Number) optional - Ifidprovided, will limit returned employees detail to a single employee, if noidprovided an array of employees will be returned.
services([id])
id(Number) optional - Ifidprovided, will limit returned services to a single service, if noidprovided an array of services will be returned.
openings(id[, options])
id(Number|Array) required - The service id or an array of services are required to get the openingsoptions(Object) optional - See FullSlate API documentation for full options and, example options areemployees,before,after,window,range
bookings(id)
id(Number) required - The booking id, which will return details of the booking
book(options)
options(Object) required - See FullSlate API documentation for full options and descriptions. The booking object at minimum must includeat,service,first_name, andlast_nameand any additional requirements specified by the provider.
Private Company Resource APIs
The FullSlate API token must be defined for the following calls.
clients([id][, options])
id(Number) optional - If anumberis specified, the library will assume it is a clientidwhich will limit the response to the specific clientid. If noidis specified, a full list of clients will be returned. This first parameter can also be anobjectwhich will return the full list of clients with theobjectacting as theoptions.options(Object) optional - See FullSlate API documentation for full optionsoptions.include(Array) optional - Additional fields to include in the response API, valid values includeemails,phone_numbers,addresses, andlinks.
events([id][, options])
id(Number) optional - If anumberis specified, the library will assume it is an eventidwhich will limit the response to the specific eventid. If noidis specified, a list of events will be returned. The first parameter can also be anobjectwhich will return the full list of events with theobjectacting as theoptions.options(Object) optional - See FullSlate API documentation for full options, date parameters must be in the format ofYYYY-MM-DD.
products([id])
id(Number) optional - Ifidprovided, will limit returned products to a single product, if noidprovided an array of products will be returned.
vouchers([id])
id(Number) optional - Ifidprovided, will limit returned vouchers to a single voucher, if noidprovided an array of vouchers will be returned.
Contributing
Running tests
To run the test suite, you'll have to define your API key and token as an export:
OSX
$ export FULLSLATE_TOKEN=MY_TOKEN_123456
$ export FULLSLATE_KEY=MY_KEY$ npm testTODO
- Clean up the code, it's not very DRY
- Implement
Cross-realm OpeningsandCompany Configuration - Make more robust tests