Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/base-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ import {
InquirePayload,
cliux,
isAuthenticated,
ContentstackMarketplaceClient,
marketplaceSDKInitiator,
marketplaceSDKClient,
} from "@contentstack/cli-utilities";

import config from "./config";
Expand All @@ -39,6 +42,7 @@ export abstract class BaseCommand<T extends typeof Command> extends Command {
};
protected managementSdk!: ContentstackClient;
protected managementAppSdk!: ContentstackClient;
protected marketplaceAppSdk!: ContentstackMarketplaceClient;

protected flags!: Flags<T>;
protected args!: Args<T>;
Expand Down Expand Up @@ -72,6 +76,7 @@ export abstract class BaseCommand<T extends typeof Command> extends Command {
this.developerHubBaseUrl =
this.sharedConfig.developerHubBaseUrl || getDeveloperHubUrl();
await this.initCmaSDK();
await this.initMarketplaceSDK();

// Init logger
const logger = new Logger(this.sharedConfig);
Expand Down Expand Up @@ -126,6 +131,13 @@ export abstract class BaseCommand<T extends typeof Command> extends Command {
host: this.developerHubBaseUrl,
});
}

async initMarketplaceSDK() {
marketplaceSDKInitiator.init(this.context);
this.marketplaceAppSdk = await marketplaceSDKClient({
host: this.developerHubBaseUrl,
});
}

/**
* @method getValPrompt
Expand Down
4 changes: 2 additions & 2 deletions src/commands/app/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@ export default class Create extends BaseCommand<typeof Create> {
appName: this.sharedConfig.appName,
})
);
await this.managementAppSdk
.organization(this.sharedConfig.org)
await this.marketplaceAppSdk
.marketplace(this.sharedConfig.org)
.app()
.create(this.appData as AppData)
.then((response) => {
Expand Down
6 changes: 5 additions & 1 deletion src/util/common-utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ContentstackClient, FlagInput } from "@contentstack/cli-utilities";
import { ContentstackClient, FlagInput, ContentstackMarketplaceClient } from "@contentstack/cli-utilities";
import { AppLocation, Extension, LogFn } from "../types";
import { cliux, Stack } from "@contentstack/cli-utilities";
import { apiRequestHandler } from "./api-request-handler";
Expand All @@ -7,6 +7,10 @@ export type CommonOptions = {
log: LogFn;
managementSdk: ContentstackClient;
};
export type MarketPlaceOptions = {
log: LogFn;
marketplaceSdk: ContentstackMarketplaceClient;
};

async function getOrganizations(
options: CommonOptions,
Expand Down