(owner, repository, tagName, releaseName, releaseNotes, isDraft, isPrerelease)
| 1804 | try { |
| 1805 | const apiUrl = 'https://connect-api.cloud.huawei.com/api/publish/v2/app-submit' + |
| 1806 | '?appId=' + settings.huawei.app_id; |
| 1807 | const response = await postHttp(apiUrl, info, false, { |
| 1808 | headers: { |
| 1809 | 'client_id': settings.huawei.client_id, |
| 1810 | 'Authorization': 'Bearer ' + accessToken, |
| 1811 | 'User-Agent': 'Telegram-X-Publisher' |
| 1812 | } |
| 1813 | }); |
| 1814 | if (response.statusCode !== 200) { |
| 1815 | console.error('AGC update langauge info failed', response.statusCode, response.statusMessage, response.contentType, response.content); |
| 1816 | return null; |
| 1817 | } |
| 1818 | return JSON.parse(response.content); |
| 1819 | } catch (e) { |
| 1820 | console.error('Unable to submit AGC app for review', e); |
| 1821 | return null; |
| 1822 | } |
| 1823 | } |
| 1824 | |
| 1825 | function uploadToHuaweiAppGallery (task, build, onDone, draftOnly) { |
| 1826 | (async () => { |
| 1827 | const sdkVariant = 'latest'; |
| 1828 | const abiVariant = 'universal'; |
| 1829 | const targetFiles = build.files[sdkVariant][abiVariant]; |
| 1830 | // Step 1. Obtain access_token |
| 1831 | const auth = await obtainHuaweiAccessToken(); |
| 1832 | if (!auth || !auth.access_token) { |
| 1833 | onDone(1); |
| 1834 | return; |
| 1835 | } |
| 1836 | // Step 2. Obtain upload_url |
| 1837 | const upload = await obtainHuaweiUploadUrl(auth.access_token); |
| 1838 | if (!upload || !upload.uploadUrl || !upload.authCode) { |
| 1839 | onDone(1); |
| 1840 | return; |
no test coverage detected