GithubHelp home page GithubHelp logo

tp-api's People

Contributors

8bitdesigner avatar jeffuyeno avatar xmik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

tp-api's Issues

Release 1.0.6

@8bitDesigner , could you release current master as 1.0.6 so that npm install tp-api installs 1.0.6?


Update: or maybe I can release it?

option to use http

Awesome API, I had to make an alteration though to use http. I may not be doing it right but I at least got it working after playing with your code. Maybe you wanna add the option to index.js?

var protocol = opts.insecure ? 'http://' : 'https://'
var url = protocol+.....

Consider a Promise-style `then` & `catch`

It might be beneficial to make a breaking change to convert then's interface over to just emit the found entities, and have a separate catch callback, so that requests adhere to Promise's interface. This would allow easy interop with async/await

Add JSON.stringify() possibility in readme

First, thank you for tp-api. The code still works, I'd just like to suggest adding one note to readme.

Using a very similar example to the one from readme:

tp('Tasks')
  .take(1)
  .where("EntityState.Name eq 'Open'")
  .pluck("CustomFields")
  .sortBy('NumericPriority')
  .then(function(err, tasks) {
    console.log('my tasks', tasks)
  }
)

The returned tasks here is a JavaScript object which can return:

my tasks [ { ResourceType: 'Task',
    Id: 3631,
    Project: { ResourceType: 'Project', Id: 4026, Process: [Object] },
    CustomFields: [ [Object], [Object], [Object], [Object], [Object] ] } ]

In order to convert it into JSON string, the following is enough:

tp('Tasks')
  .take(1)
  .where("EntityState.Name eq 'Open'")
  .pluck("CustomFields")
  .sortBy('NumericPriority')
  .then(function(err, tasks) {
    console.log('my tasks', JSON.stringify(tasks))  // changed here
  }
)

and now it returns:

my tasks [{"ResourceType":"Task","Id":3631,"Project":{"ResourceType":"Project","Id":4026,"Process":{"Id":5,"Name":"AIScrum"}},"CustomFields":[{"Name":"Component","Type":"DropDown","Value":null},{"Name":"trac","Type":"Number","Value":null},{"Name":"Job","Type":"DropDown","Value":null},{"Name":"Resolution","Type":"DropDown","Value":null},{"Name":"Domain","Type":"DropDown","Value":null}]}]

It took me some time to find out about it, so I'd like to spare this time for others.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.