Folder
Folder
Folders refer to Asset Folders.
update
The Update Folder call lets you update the name and description of an existing Folder.
import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })
client.stack({ api_key: 'api_key'}).asset().folder('uid')
.fetch()
.then((folder) => {
folder.name = 'My New folder'
return folder.update()
})
.then((folder) => console.log(folder))delete
The Delete folder call will delete an existing folder from the stack.
import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })
client.stack({ api_key: 'api_key'})asset()
.folder('uid')
.delete()
.then((response) => console.log(response.notice))fetch
The fetch a folder call returns comprehensive information about folder of a stack.
import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })
client.stack({ api_key: 'api_key'}).asset()
.folder('uid')
.fetch()
.then((folder) => console.log(folder))create
The Create a Folder call creates a folder into the assets.
| Name | Type | Description |
|---|---|---|
| params.asset (required) | object | Folder details to create. |
import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })
const asset = {name: 'My New contentType'}
client.stack({ api_key: 'api_key'}).asset().folder().create({ asset })
.then((folder) => console.log(folder))