Access 'getTaskCountsForProject' method
cbroome opened this issue · 6 comments
I'm having trouble figuring out how to call this method. I'd assume it'd be off the projects object, but its not found.
I'm expecting the syntax to be something like this:
client.projects.getTaskCountsForProject( projectGid )
.then(function(data) {
debugger;
// Print out your information
console.log(data);
});
What's the proper way to access it?
Hmm that's concerning.
I'm able to get it to run using your snippet.
client.projects.getTaskCountsForProject( projectGid )
.then(function(data) {
debugger;
// Print out your information
console.log(data);
});
Perhaps you're not on the latest node-asana?
Try
npm install asana@0.18.0
Also, you'll get back an empty object unless you opt_fields into something ( see https://developers.asana.com/docs/#get-task-count-of-a-project ). My code looks like this:
client.projects.getTaskCountsForProject( projectGid, {opt_fields: "num_tasks"} )
.then(function(data) {
debugger;
// Print out your information
console.log(data);
});
I don't know what I'm doing wrong then. I tried deleting the npm cache, repulling and it still wasn't available. I tried pulling on a different laptop and it wasn't available. I tried doing a grep through the codebase and could not even find the string 'getTaskCountsForProject'.
You're onto something. I was able to repro it on a different computer. I'll look into it.
In the meantime, you can use the function contents (as the function is essentially just a wrapper for the path).
asana.resources.Resource.unwrap(client.dispatcher.get("/projects/{project_gid}/task_counts", {opt_fields: "num_tasks"}, null))
.then(function (data) {
debugger;
// Print out your information
console.log(data);
});
Hey @cbroome ,
Thanks again for finding this. This should be resolved if you upgrade to asana@0.18.3.
Let me know if you have any issues with it!
Best,
Ross
Just in the nick of time, thanks for fixing this!