UNPKG

timekit-sdk

Version:

JavaScript SDK for the Timekit API (timekit.io)

60 lines (49 loc) 2.09 kB
<!doctype html> <html> <head> <title>TimeKit SDK</title> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=device-width, initial-scale=1"> <style type="text/css"> body { font-family: helvetica, verdana, arial, sans-serif; color: #383838; margin: 30px; } code { font-family: monospace; } </style> </head> <body> <h1>Timekit JS SDK AMD module (require.js) example</h1> <p>First we load require.js and then require timekit.js as a dependency - see the page source code. When loaded, we can perform calls using the SDK.</p> <script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js"></script> <script> require(['timekit-sdk'], function (timekit) { timekit.configure({ apiBaseUrl: 'https://api.timekit.io/', appKey: 'test_api_key_AzkHV8q7s1KArB70x7ZVgjAzHsBindVW', }); // get list of services timekit .getServices() .then((services) => console.log(services.data.map(service => service.name))) .catch((error) => console.log(error)); // get list of locations timekit .getLocations() .then((locations) => console.log(locations.data.map(location => location.name))) .catch((error) => console.log(error)); const serviceUuid = 'b180fcb5-0852-4fec-8746-08f9d24e6581'; const locationUuid = 'ac3ab119-28b7-4418-bae7-1c464ae8b9d8'; // get location service projects timekit .getLocationServiceProjects(locationUuid, serviceUuid) .then((projects) => console.log(projects.data)) .catch((error) => console.log(error)); }); </script> </body> </html>