Utilities for intearcting with Hosted App Actions
npm install @contentful/app-action-utilsThis repo is a growing collection of utils for interacting with App Actions
shell
npm install --save @contentful/app-action-utils
or
yarn add @contentful/app-action-utils
`Available features
Right now it only supports calling the app action and retrieving the result. This consist of:
- Calling app actions
- Getting an app action result
- Polling, retrying and parsing of the details call
Requirements
When passing the plain client generated from
contentful-management, it has to have org, space and environment set as defaults. If not you can pass in the spaceId and environmentId to each of the methods.
Usage
$3
To call an app action and get the result callAppAction can be used like this`ts
import { createClient } from 'contentful-management'
const api = createClient({
accessToken: ''
}, {
type: 'plain'
})
const parameters: AppActionCategoryParams<''> = {} // The parameters the app action expects, when the generic is correct it will be fully typed
const abortController = new AbortController()
const additionalParameters = {
spaceId: '',
environmentId: ''
}
const appActionResult = await callAppAction({
api,
appActionId: '',
appDefinitionId: '',
parameters,
})
`$3
`ts
const appActionResult = await callAppActionResult({
api,
appActionId: '',
callId: '',
spaceId: '',
environmentId: ''
})
``