* Get information about all cards of a project * @see https://developer.github.com/v3/projects/cards/#list-project-cards * @param {Requestable.callback} [cb] - will receive the list of cards * @return {Promise} - the promise for the http request
(cb)
| 133 | * @return {Promise} - the promise for the http request |
| 134 | */ |
| 135 | listProjectCards(cb) { |
| 136 | return this.listProjectColumns() |
| 137 | .then(({data}) => { |
| 138 | return Promise.all(data.map((column) => { |
| 139 | return this._requestAllPages(`/projects/columns/${column.id}/cards`, null); |
| 140 | })); |
| 141 | }).then((cardsInColumns) => { |
| 142 | const cards = cardsInColumns.reduce((prev, {data}) => { |
| 143 | prev.push(...data); |
| 144 | return prev; |
| 145 | }, []); |
| 146 | if (cb) { |
| 147 | cb(null, cards); |
| 148 | } |
| 149 | return cards; |
| 150 | }).catch((err) => { |
| 151 | if (cb) { |
| 152 | cb(err); |
| 153 | return; |
| 154 | } |
| 155 | throw err; |
| 156 | }); |
| 157 | } |
| 158 | |
| 159 | /** |
| 160 | * Get information about all cards of a column |
no test coverage detected