CHECKROOM CORE JS
A JavaScript wrapper around the CHEQROOM REST API
Docs
http://checkroom.github.io/checkroom_core_js/
Install
npm install cheqroom-core
Usage
var cr = ; //// Authenticating via username and password//var baseUrl = 'https://api.cheqroom.com/api/v2_5';var userName = "";var password = ""; var ajax = ;var auth = ajax: ajax urlAuth: baseUrl + '/authenticate';var authUser = null; auth ; ... //// Using datasources// // Listing open ordersvar dsOrders = collection: 'orders' ajax: ajax user: authUser urlApi: baseUrl;dsOrders ; // Finding a contact by namevar dsContacts = collection: 'customers' /* !! */ ajax: ajax user: authUser urlApi: baseUrl;dsContacts ; // Finding an item by idvar dsItems = collection: 'items' ajax: ajax user: authUser urlApi: baseUrl;dsItems ; // Finding an availability of an itemvar dsItems = collection: 'items' ajax: ajax user: authUser urlApi: baseUrl;dsItems ; var dsAvailabilities = collection: 'availabilities' ajax: ajax user: authUser urlApi: baseUrl;dsAvailabilities ; // Creating a new User (send invite email and create a corresponding Customer document)var dsUsers = collection: 'users' ajax: ajax user: authUser urlApi: baseUrl;dsUsers ; //// Using models//// Getting an Item by its primary keyvar item = ds: dsItems id: 'ANY-ITEM-ID'); item ; // Getting a Contact by its primary key and updating its company namevar contact = ds: dsContacts id: 'ANY-CONTACT-ID'); contact ; //// Query operators//Operators other than equality may also be used in queries — just attach the operator name to a key with a double-underscore: ne – not equal tolt – less thanlte – less than or equal togt – greater thangte – greater than or equal tonot – negate a standard check may be used before other in – value is in nin – value is not in mod – value % x == y where x and y are two provided valuesall – every item in list of values provided is in arraysize – the size of the array isexists – value for field exists //// String search syntax//The following operators are available as shortcuts to querying with regular expressions: exact – string field exactly matches valueiexact – string field exactly matches contains – string field contains valueicontains – string field contains startswith – string field starts with valueistartswith – string field starts with endswith – string field ends with valueiendswith – string field ends with match – performs an $elemMatch so you can match an entire document within an array
Build instructions
Call grunt
to build and run the tests
Call grunt docs
to rebuild the documentation
Call grunt gh-pages
to publish the documentation
Copyright CHECKROOM NV 2020