Wizcorp / node-pivotal

NodeJS API library for PivotalTracker
44 stars 20 forks source link

Feature: All API calls returning lists should return arrays #20

Open stelcheck opened 11 years ago

stelcheck commented 11 years ago

Ideally, we will want to have some factory function for dealing with lists, and allowing us to simply plug that extra parser in each list API calls.

MRdNk commented 11 years ago

Do you think, it should always be returned within an object like it currently is...

{
  story: [{story1}, {story2}]
}

Or just an array of objects?

[{story1}, {story2}]

The first one, with a factory function is going to require us to pass in the key of the object as in 'story'. Unless you can think of a better way?

Why?

No stories (or other API call)

{}

One story

{
  story: {}
}

One+ story

{
  story: [{story}, {story}]
}

So no stories, just gives us an empty object, so we'd need to give it a key name in for consistancy.

MRdNk commented 11 years ago

We could change

// from
pivotal.apiCall = function (method, pathSegments, query, data, file, cb) 

// to
pivotal.apiCall = function (method, pathSegments, query, data, file, keyName, cb) 
MRdNk commented 11 years ago

Or alternatively see #22 & #23