Skip to content

Commit

Permalink
Update import_rich_create_simple_type.js
Browse files Browse the repository at this point in the history
  • Loading branch information
saminamhk committed Mar 14, 2024
1 parent 33c3109 commit c203cb2
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions js/import-rich-text/import_rich_create_simple_type.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
// Tip: Find more about JS/TS SDKs at https://kontent.ai/learn/javascript
// Using ES6 syntax
import { ManagementClient, ElementModels } from '@kontent-ai/management-sdk';
import { ManagementClient } from '@kontent-ai/management-sdk';

const client = new ManagementClient({
environmentId: '<YOUR_ENVIRONMENT_ID>',
apiKey: '<YOUR_API_KEY>'
environmentId: '<YOUR_ENVIRONMENT_ID>',
apiKey: '<YOUR_API_KEY>'
});

const response = await client.addContentType()
.withData(
{
external_id: "simple-rich-text",
name: "Simple Rich Text",
elements: [
{
name: "Rich Text",
type: ElementModels.ElementType.RichText,
external_id: "rich-text"
}
]
}
)
.toPromise();
const response = await client
.addContentType()
.withData((builder) => {
return {
external_id: 'simple-rich-text',
name: 'Simple Rich Text',
elements: [
{
name: 'Rich Text',
type: 'rich_text',
external_id: 'rich-text'
}
]
};
})
.toPromise();

0 comments on commit c203cb2

Please sign in to comment.