ideagen-timeline-sdk
v1.3.0
Published
This lib provides an SDK for the Timeline API from Ideagen. See the API code [here](https://github.com/gael-ltd/IdeagenGCU2018)
Downloads
15
Readme
Ideagen Timeline SDK
This lib provides an SDK for the Timeline API from Ideagen. See the API code here
Usage
This library is intended to be used with NodeJS. It work on the front-end and on the back-end. In order to use it in the browser, you might consider using JavaScript bundler, such as Webpack as well as a javascript compiler, such as Babel
Install
This Library works with NodeJS and is available in the npm registry. To install it execute:
npm install --save ideagen-timeline-sdk
Initialisation
We can use the API by instantiating new timelineSDK object:
var IdeagenTimelineSDK = require('ideagen-timeline-sdk')
var ideagenTimelineSDK = new ideagenTimelineSDK({
TenantId: 'PUT YOUR TENANT ID HERE',
AuthToken: 'PUT YOUR AUTH TOKEN HERE'
})
Timelines
Create Timeline
ideagenTimelineSDK.timelines
.create({
TimelineId: '1234',
Title: 'Some Title'
})
.then(function (response) {
// response is the response object from the server
console.log(response)
})
.catch(function (error) {
// error is the error message
console.error(error)
})
Edit Timeline Title
ideagenTimelineSDK.timelines
.editTimelineTitle('1234', 'New title')
.then(function (response) {
// response is the response object from the server
console.log(response)
})
.catch(function (error) {
// error is the error message
console.error(error)
})
Retrieve Timeline
ideagenTimelineSDK.timelines
.get('1234')
.then(function (response) {
// response is the response object from the server
console.log(response)
})
.catch(function (error) {
// error is the error message
console.error(error)
})
List Timelines
ideagenTimelineSDK.timelines
.getAll()
.then(function (response) {
// response is the response object from the server
console.log(response)
})
.catch(function (error) {
// error is the error message
console.error(error)
})
Delete Timeline
ideagenTimelineSDK.timelines
.delete('1234')
.then(function (response) {
// response is the response object from the server
console.log(response)
})
.catch(function (error) {
// error is the error message
console.error(error)
})
Link Event to Timeline
ideagenTimelineSDK.timelines
.linkEvent('TimelineId', 'EventId')
.then(function (response) {
// response is the response object from the server
console.log(response)
})
.catch(function (error) {
// error is the error message
console.error(error)
})
Unlink Event from Timeline
ideagenTimelineSDK.timelines
.unlinkEvent('TimelineId', 'EventId')
.then(function (response) {
// response is the response object from the server
console.log(response)
})
.catch(function (error) {
// error is the error message
console.error(error)
})
Get Timeline Linked Events
ideagenTimelineSDK.timelines
.getLinkedEvents('TimelineId')
.then(function (response) {
// response is the response object from the server
console.log(response)
})
.catch(function (error) {
// error is the error message
console.error(error)
})
TimelineEvent
Create Timeline Event
ideagenTimelineSDK.timelineEvents
.create({
TimelineEventId: '1234',
Title: 'TestTitle',
Description: 'TestDescription',
EventDateTime: 'EventDateTime',
Location: 'Location'
})
.then(function (response) {
// response is the response object from the server
console.log(response)
})
.catch(function (error) {
// error is the error message
console.error(error)
})
Retrieve Timeline Event
ideagenTimelineSDK.timelineEvents
.get('1234')
.then(function (response) {
// response is the response object from the server
console.log(response)
})
.catch(function (error) {
// error is the error message
console.error(error)
})
Edit Timeline Event Title
ideagenTimelineSDK.timelineEvents
.editTitle('1234', 'New Title')
.then(function (response) {
// response is the response object from the server
console.log(response)
})
.catch(function (error) {
// error is the error message
console.error(error)
})
Edit Timeline Event Description
ideagenTimelineSDK.timelineEvents
.editDescription('1234', 'New Description')
.then(function (response) {
// response is the response object from the server
console.log(response)
})
.catch(function (error) {
// error is the error message
console.error(error)
})
Edit Timeline Event Location
ideagenTimelineSDK.timelineEvents
.editLocation('1234', 'New Location')
.then(function (response) {
// response is the response object from the server
console.log(response)
})
.catch(function (error) {
// error is the error message
console.error(error)
})
Edit Timeline Event DateTime
ideagenTimelineSDK.timelineEvents
.editDateTime('1234', 'New Date Time')
.then(function (response) {
// response is the response object from the server
console.log(response)
})
.catch(function (error) {
// error is the error message
console.error(error)
})
Delete Timeline Event
ideagenTimelineSDK.timelineEvents
.delete('1234')
.then(function (response) {
// response is the response object from the server
console.log(response)
})
.catch(function (error) {
// error is the error message
console.error(error)
})
Contribution
How to Install for Development:
- You need to install
node
andnpm
.
node
version: v8.9.1npm
version: 5.6.0
- Clone the repository
git clone https://github.com/dirchev/ip3-ideagen-timeline-sdk
- Enter the folder
cd ./ip3-ideagen-timeline-sdk
- Install dependencies
npm install
- Run Tests
npm test
Bugs and New Features
Feel free to report bugs or suggest new features here.
Contribution
If you want to fix/update/improve something - fork and create a PR to this repository. Please write/update the tests!