|
1 | | -import { FlagInput } from "@contentstack/cli-utilities"; |
| 1 | +import { ContentstackClient, FlagInput } from "@contentstack/cli-utilities"; |
2 | 2 | import { UninstallApp } from "../interfaces/uninstall-app"; |
3 | 3 | import { CommonOptions, getInstallation, uninstallApp } from "../util"; |
4 | 4 | import { AppTarget } from "@contentstack/management/types/app/index" |
5 | 5 |
|
6 | 6 | export class UninstallSelected implements UninstallApp { |
7 | | - public async run(flags: FlagInput, org: string, options: CommonOptions, appType: AppTarget): Promise<void> { |
| 7 | + public async run(flags: FlagInput, org: string, managementSdk: ContentstackClient, options: CommonOptions, appType: AppTarget): Promise<void> { |
8 | 8 | // select installation uid to uninstall |
9 | | - const installationUids = await this.getInstallations(flags, org, options, appType) |
| 9 | + const installationUids = await this.getInstallations(flags, org, managementSdk, options, appType) |
10 | 10 | for (const installationUid of installationUids) { |
11 | 11 | await uninstallApp(flags, org, options, installationUid) |
12 | 12 | } |
13 | 13 | } |
14 | 14 |
|
15 | | - public async getInstallations(flags: FlagInput, org: string, options: CommonOptions, appType: AppTarget): Promise<string[]> { |
| 15 | + public async getInstallations(flags: FlagInput, org: string, managementSdk: ContentstackClient, options: CommonOptions, appType: AppTarget): Promise<string[]> { |
16 | 16 | let installationUids: any = flags['installation-uid']; |
17 | 17 | if (!installationUids) { |
18 | | - installationUids = await getInstallation(flags, org, options.managementSdk, appType, options) |
| 18 | + installationUids = await getInstallation(flags, org, managementSdk, appType, options) |
19 | 19 | } |
20 | 20 | return installationUids.split(',') |
21 | 21 | } |
|
0 commit comments