AllegiantAir / g4js-cognos

Node.js client for Cognos application integration utilizing CMS.
MIT License
5 stars 9 forks source link

How to get a list of available reports? #10

Open xumes opened 6 years ago

xumes commented 6 years ago

Hello, is there a way to retrieve a list of available reports/dashboards/folders?

I am implementing a solution that access a Cognos environment, retrieves a list of reports and allow user to decide which report will open/run.

Thanks for the attention.

helloanoop commented 6 years ago

Have raised a PR for this https://github.com/AllegiantAir/g4js-cognos/pull/11 cc @nesbert That should get you access to the request object on which you can do a GET with the url that you have.

Here is a reference sample of how you could extend it

const MyCms = require('g4js-cognos').Cms;
MyCms.prototype.getDashboardList = function() {
  return new Promise(function(resolve, reject) {
    // here you can access this.request and do a custom fetch with your url 
  });
});

// const report = new Cms(config.serviceUrl.....blah blah blah)
report
   .getDashboardList()
   .then() // success
   .failure() // failure

Hope it helps !

nesbert commented 6 years ago

Hi @anoopmd just getting back from vacation. Will review when I can.

nesbert commented 6 years ago

Simple enough change, not sure why the commits in the PR.

Going to cut a separate release branch for the change and minor version bump. To be safe.

helloanoop commented 6 years ago

Thanks @nesbert Even I was surprised to see so many commits. Likely because I committed the changes and later synced my fork with the main g4js-cognos before raising the PR.