just-a-test-of-custom-app
v0.4.0
Published
The Kontent.ai Custom App SDK enhances the integration of your custom app with the Kontent.ai platform.
Maintainers
Readme
Kontent.ai Custom app SDK JS
About The Project
The Kontent.ai Custom App SDK enhances the integration of your custom app with the Kontent.ai platform.
Getting Started
Installation
npm install @kontent-ai/custom-app-sdk-jsUsage
import { getCustomAppContext, CustomAppContext } from "@kontent-ai/custom-app-sdk-js";
const response: CustomAppContext = await getCustomAppContext();
if (response.isError) {
console.error({ errorCode: response.code, description: response.description});
} else {
console.log({ config: response.config, context: response.context });
}getCustomAppContext function
Use the getCustomAppContext function to retrieve context of the custom app. The function takes no arguments and returns a promise with a value of an object of type CustomAppContext.
CustomAppContext
| Property | Type | Description |
|---------------|------------------------|------------------------------------------------------------------------------|
| isError | boolean | Determines if there was an error while getting the context of the custom app |
| code | ErrorCode enum | null | The code of the error message |
| description | string | null | The description of the error message |
| context | object | null | Contains data provided by the Kontent.ai application |
| config | object | null | Contains JSON object specified in the custom app configuration |
Config object
The config object is a JSON object that can be defined within the Custom App configuration under Environment settings in the Kontent.ai app.
Context object
The context object contains data provided by the Kontent.ai application that you can leverage in your custom app.
| Property | Type | Description |
|-----------------|-------------------|--------------------------------------------------------------------------|
| environmentId | UUID | The environment's ID |
| userId | string | The current user's ID |
| userEmail | string | The current user's email |
| userRoles | Array of UserRole | An array containing all the roles of the current user in the environment |
UserRole object
| Property | Type | Description |
|------------|--------|----------------------------------------------------------------------|
| id | UUID | The role's ID |
| codename | string | The role's codename - applicable only for the Project manager role |
Contributing
For Contributing please see CONTRIBUTING.md for more information.
License
Distributed under the MIT License. See LICENSE.md for more information.
