App
App/Manifest is used for creating/updating/deleting an app in your organization.
Example:
import * as contentstack from '@contentstack/marketplace-sdk'
const app = client.marketplace('organization_uid').app('manifest_uid');| Name | Type | Description |
|---|---|---|
| manifest_uid (required) | String | UID of the manifest |
update
The update method allows you to update the app details such as name, description, icon, and so on.
Example:
import * as contentstack from '@contentstack/marketplace-sdk'
const client = contentstack.client({ authtoken: 'TOKEN'});
const updateApp = {
name: 'APP_NAME',
description: 'APP_DESCRIPTION',
target_type: 'stack'/'organization',
}
const app = client.marketplace('organization_uid').app('manifest_uid');
app = Object.assign(app, updateApp)
app.update()
.then((app) => console.log(app));fetch
The fetch method retrieves the details of a particular app with its ID.
| Name | Type | Description |
|---|---|---|
| include_oauth | Boolean | To get the oauth details of an app |
Example:
import * as contentstack from '@contentstack/marketplace-sdk'
const client = contentstack.client({ authtoken: 'TOKEN'});
client.marketplace('organization_uid').app('manifest_uid').fetch()
.then((app) => console.log(app));oauth
The oauth method allows you to retrieve and update Oauth and retrieve scopes.
| Name | Type | Description |
|---|---|---|
| include_oauth | Boolean | To get the oauth details of an app |
Example:
import * as contentstack from '@contentstack/marketplace-sdk'
const client = contentstack.client({ authtoken: 'TOKEN'});
client.marketplace('organization_uid').app('manifest_uid').oauth();delete
The delete method is used to delete the app.
Example:
import * as contentstack from '@contentstack/marketplace-sdk'
const client = contentstack.client({ authtoken: 'TOKEN'});
client.marketplace('organization_uid').app('manifest_uid').delete()
.then((response) => console.log(response));hosting
The hosting method allows you to retrieve, update, and deploy a manifest.
Example:
import * as contentstack from '@contentstack/marketplace-sdk'
const client = contentstack.client({ authtoken: 'TOKEN'});
client.marketplace('organization_uid').app('manifest_uid').hosting();install
The install method initiates the installation of the app.
| Name | Type | Description |
|---|---|---|
| param.targetType (required) | String | The target on which app needs to be installed. It can either be a stack or an organization |
| param.targetUid | String | The UID of the target, on which the app will be installed |
Example:
import * as contentstack from '@contentstack/marketplace-sdk'
const client = contentstack.client({ authtoken: 'TOKEN'});
client.marketplace('organization_uid').app('manifest_uid').install({ targetUid: 'STACK_API_KEY', targetType: 'stack' })
.then((installation) => console.log(installation));upgrade
The upgrade method upgrades the installation of an app.
| Name | Type | Description |
|---|---|---|
| param.targetType (required) | String | The target on which app needs to be installed. It can either be a stack or an organization |
| param.targetUid (required) | The uid of the target, on which the app will be installed |
Example:
import * as contentstack from '@contentstack/marketplace-sdk'
const client = contentstack.client({ authtoken: 'TOKEN'});
client.marketplace('organization_uid').app('manifest_uid').upgrade({ targetUid: 'STACK_API_KEY', targetType: 'stack' })
.then((installation) => console.log(installation));authorize
The authorize method authorizes the app for a specific scope.
| Name | Type | Description |
|---|---|---|
| param.responseType (required) | String | Desired grant type |
| param.clientId (required) | String | Client id of the app |
| param.redirectUri | String | Redirect URL of the app |
| param.scope | String | Scopes of the app |
| param.state | String | Local state provided by the client |
Example:
import * as contentstack from '@contentstack/marketplace-sdk'
const client = contentstack.client({ authtoken: 'TOKEN'});
client.marketplace('organization_uid').app('app_uid').authorize({ responseType, clientId, redirectUri, scope, state })
.then((response) => console.log(response));getRequests
The getRequests method retrieves all requests of an app.
Example:
import * as contentstack from '@contentstack/marketplace-sdk'
const client = contentstack.client({ authtoken: 'TOKEN'});
client.marketplace('organization_uid').app('app_uid').getRequests()
.then((response) => console.log(response));authorization
The authorization method allows you to retrieve all and revoke specific or all authorizations.
Example:
import * as contentstack from '@contentstack/marketplace-sdk'
const client = contentstack.client({ authtoken: 'TOKEN'});
client.marketplace('organization_uid').app('manifest_uid').authorization();listInstallations
The listInstallations method is used to retrieve all installations of your Contentstack organization.
Example:
import * as contentstack from '@contentstack/marketplace-sdk'
const client = contentstack.client({ authtoken: 'TOKEN'});
client.marketplace('organization_uid').app('app_uid').listInstallations()
.then((collection) => console.log(collection));create
The create method creates a new app/manifest in your Contentstack organization.
| Name | Type | Description |
|---|---|---|
| app_details (required) | Object | Details of the app to be created |
Example:
import * as contentstack from '@contentstack/marketplace'
const client = contentstack.client({ authtoken: 'TOKEN'});
const app = {
name: 'APP_NAME',
description: 'APP_DESCRIPTION',
target_type: 'stack'/'organization',
webhook: // optional
{
target_url: 'TARGET_URL',
channel: 'CHANNEL'
},
oauth: // optional
{
redirect_uri: 'REDIRECT_URI',
enabled: true,
}
}
client.marketplace('organization_uid').app().create(app)
.then((app) => console.log(app));