From c7a548c6f013874c42f8160b23525eb2bb8f88f5 Mon Sep 17 00:00:00 2001 From: Mustafa <971530+tosbaha@users.noreply.github.com> Date: Mon, 16 May 2022 16:19:19 +0300 Subject: [PATCH] Added listing versions by type --- CHANGELOG.md | 9 ++++++++- README.md | 2 +- src/main.ts | 8 +++++++- src/services.ts | 15 +++++++++++++-- 4 files changed, 29 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7be2599..5ba2177 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ # Changelog -### [1.0.3](https://github.com/appcircleio/appcircle-cli/compare/v1.0.2...v1.0.3) (2022-04-29) +### [1.0.4](https://github.com/appcircleio/appcircle-cli/compare/v1.0.3...v1.0.4) (2022-05-16) + +**Added** + +- Enterprise endpoints added + - [x] List Enterprise app versions by publish type (Beta, Live) + +### [1.0.3](https://github.com/appcircleio/appcircle-cli/compare/v1.0.2...v1.0.3) (2022-05-09) **Added** diff --git a/README.md b/README.md index 404cec1..3d90874 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ Below is the list of commands currently supported by Appcircle CLI: | `appcircle listEnvironmentVariables [--variableGroupId]` | Get list of environment variables | | `appcircle createEnvironmentVariable [--type] [-isSecret, --isSecret] [--variableGroupId] [--key] [--value] [--filePath]` | Create a file or text environment variable | | `appcircle listEnterpriseProfiles` | List Enterprise profiles | -| `appcircle listEnterpriseAppVersions [--entProfileId] ` | List Enterprise app versions | +| `appcircle listEnterpriseAppVersions [--entProfileId] [--publishType]` | List Enterprise app versions | | `appcircle publishEnterpriseAppVersion [--entProfileId] [--entVersionId] [--entVersionId] [--summary] [--releaseNotes] [--publishType]` | Publish Enterprise app version | | `appcircle publishEnterpriseAppVersion [--entProfileId] [--entVersionId]` | Unpublish Enterprise app version | | `appcircle removeEnterpriseAppVersion [--entProfileId] [--entVersionId]` | Remove Enterprise app version | diff --git a/src/main.ts b/src/main.ts index e6837ea..df17687 100644 --- a/src/main.ts +++ b/src/main.ts @@ -284,6 +284,12 @@ const Commands = [ name: 'entProfileId', description: 'Enterprise Profile ID', type: CommandParameterTypes.SELECT + }, + { + name: 'publishType', + description: '[OPTIONAL] Publish Type Empty,0=All,1=Beta,2=Live', + type: CommandParameterTypes.STRING, + required: false } ] }, @@ -484,7 +490,7 @@ const Commands = [ spinner.succeed(); } else if (param.name === 'entVersionId') { const spinner = ora('Enterprise Versions fetching').start(); - const profiles = await getEnterpriseAppVersions({entProfileId: params.entProfileId}); + const profiles = await getEnterpriseAppVersions({entProfileId: params.entProfileId, publishType: ''}); if (!profiles || profiles.length === 0) { spinner.text = 'No version available'; spinner.fail(); diff --git a/src/services.ts b/src/services.ts index 8bfc0ee..01f07a1 100644 --- a/src/services.ts +++ b/src/services.ts @@ -548,9 +548,20 @@ export async function getEnterpriseProfiles() { } } -export async function getEnterpriseAppVersions(options: { entProfileId: string }) { +export async function getEnterpriseAppVersions(options: { entProfileId: string,publishType: string }) { + let versionType = ''; + switch (options.publishType) { + case '1': + versionType = '?publishtype=Beta'; + break; + case '2': + versionType = '?publishtype=Live'; + default: + break; + } + try { - const profileResponse = await axios.get(`${API_HOSTNAME}/store/v2/profiles/${options.entProfileId}/app-versions`, + const profileResponse = await axios.get(`${API_HOSTNAME}/store/v2/profiles/${options.entProfileId}/app-versions${versionType}`, { headers: getHeaders() });