Environment

Environment

Source:
Environment instances.

Type Definitions

Environment

Source:
Properties:
Name Type Description
sys Object System metadata
Properties
Name Type Description
id string Environment id
type string Entity type
name string Environment name
toPlainObject() function Returns this Environment as a plain JS object

SpaceCollection

Source:
Properties:
Name Type Description
total number
skip number
limit number
items Array.<Environment.Environment>
toPlainObject() function Returns this Environment collection as a plain JS object

Methods

(static) delete() → {Promise}

Source:
Deletes the environment
Example
const contentful = require('contentful-management')

const client = contentful.createClient({
  accessToken: '<content_management_api_key>'
})

client.getSpace('<space_id>')
.then((space) => space.getEnvironment('<environment-id>'))
.then((environment) => environment.delete())
.then(() => console.log('Environment deleted.'))
.catch(console.error)
Returns:
Promise for the deletion. It contains no data, but the Promise error case should be handled.
Type
Promise

(static) update() → {Promise.<Environment.Environment>}

Source:
Updates the environment
Example
const contentful = require('contentful-management')

const client = contentful.createClient({
  accessToken: '<content_management_api_key>'
})

client.getSpace('<space_id>')
.then((space) => space.getEnvironment('<environment-id>'))
.then((environment) => {
  environment.name = 'New name'
  return environment.update()
})
.then((environment) => console.log(`Environment ${environment.sys.id} renamed.`)
.catch(console.error)
Returns:
Promise for the updated environment.
Type
Promise.<Environment.Environment>