(build, targetFiles, accessToken, fileInfo)
| 1639 | } |
| 1640 | |
| 1641 | async function updateHuaweiAppFileInfo (build, targetFiles, accessToken, fileInfo) { |
| 1642 | try { |
| 1643 | const apiUrl = 'https://connect-api.cloud.huawei.com/api/publish/v2/app-file-info' + |
| 1644 | '?appId=' + settings.huawei.app_id; |
| 1645 | const fileName = build.version.name + '.' + build.git.commit.short + '.apk'; |
| 1646 | const data = { |
| 1647 | fileType: 5, |
| 1648 | files: [{ |
| 1649 | fileName: fileName, |
| 1650 | // The typo in the second "URL" (ULR) is intended ... |
| 1651 | fileDestUrl: fileInfo.fileDestUlr |
| 1652 | }] |
| 1653 | }; |
| 1654 | const response = await postHttp(apiUrl, data, false, { |
| 1655 | headers: { |
| 1656 | 'client_id': settings.huawei.client_id, |
| 1657 | 'Authorization': 'Bearer ' + accessToken, |
| 1658 | 'User-Agent': 'Telegram-X-Publisher' |
| 1659 | } |
| 1660 | }, 'PUT'); |
| 1661 | if (response.statusCode !== 200) { |
| 1662 | console.error('AGC update failed', response.statusCode, response.statusMessage, response.contentType, response.content); |
| 1663 | return null; |
| 1664 | } |
| 1665 | return JSON.parse(response.content); |
| 1666 | } catch (e) { |
| 1667 | console.error('Failed to publish AGC update', e); |
| 1668 | return null; |
| 1669 | } |
| 1670 | } |
| 1671 | |
| 1672 | async function updateHuaweiAppLanguageInfo (accessToken, info) { |
| 1673 | try { |
no test coverage detected