Skip to content

Commit

Permalink
Merge pull request #7 from appcircleio/feature/enterprise-store
Browse files Browse the repository at this point in the history
Added listing versions by type
  • Loading branch information
tosbaha authored May 16, 2022
2 parents 2987431 + c7a548c commit fb218c1
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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**

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
8 changes: 7 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
]
},
Expand Down Expand Up @@ -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();
Expand Down
15 changes: 13 additions & 2 deletions src/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
});
Expand Down

0 comments on commit fb218c1

Please sign in to comment.