ideagen-timeline-sdk

1.3.0 • Public • Published

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:

  1. You need to install node and npm.
  • node version: v8.9.1
  • npm version: 5.6.0
  1. Clone the repository
git clone https://github.com/dirchev/ip3-ideagen-timeline-sdk
  1. Enter the folder
cd ./ip3-ideagen-timeline-sdk
  1. Install dependencies
npm install
  1. 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!

Package Sidebar

Install

npm i ideagen-timeline-sdk

Weekly Downloads

0

Version

1.3.0

License

MIT

Unpacked Size

36.4 kB

Total Files

18

Last publish

Collaborators

  • dirchev