1 | 'use strict';
|
2 |
|
3 | let FindRelease = function (heroku, app, search) {
|
4 | return heroku.request({
|
5 | path: `/apps/${app}/releases`,
|
6 | partial: true,
|
7 | headers: { 'Range': 'version ..; max=10, order=desc' }
|
8 | }).then(search);
|
9 | };
|
10 |
|
11 | let FindByLatestOrId = function (heroku, app, release) {
|
12 | let id = (release || 'current').toLowerCase();
|
13 | id = id.startsWith('v') ? id.slice(1) : id;
|
14 | if (id === 'current') {
|
15 | return FindRelease(heroku, app, releases => releases[0]);
|
16 | } else {
|
17 | return heroku.get(`/apps/${app}/releases/${id}`);
|
18 | }
|
19 | };
|
20 |
|
21 | module.exports = {
|
22 | FindRelease,
|
23 | FindByLatestOrId
|
24 | }; |
\ | No newline at end of file |