Environment

Environment

Source:
A publishing environment corresponds to one or more deployment servers or a content delivery destination where the entries need to be published. Read more about Environment.

Methods

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

Source:
The Update Environment call lets you update the name and description of an existing Environment.
Example
import * as contentstack from '@contentstack/management'
const client = contentstack.client()

client.stack({ api_key: 'api_key'}).environment('uid').fetch()
.then((environment) => {
 environment.title = 'My New Content Type'
 environment.description = 'Content Type description'
 return environment.update()
})
.then((environment) => console.log(environment))
Returns:
Promise for Environment instance
Type
Promise.<Environment.Environment>

(static) delete() → {Object}

Source:
The Delete Environment call is used to delete an existing Environment permanently from your Stack.
Example
import * as contentstack from '@contentstack/management'
const client = contentstack.client()

client.stack({ api_key: 'api_key'}).environment('uid').delete()
.then((response) => console.log(response.notice))
Returns:
Response Object.
Type
Object

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

Source:
The fetch Environment call fetches Environment details.
Example
import * as contentstack from '@contentstack/management'
const client = contentstack.client()

client.stack({ api_key: 'api_key'}).environment('uid').fetch()
.then((environment) => console.log(environment))
Returns:
Promise for Environment instance
Type
Promise.<Environment.Environment>

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

Source:
The Create a Environment call creates a new environment in a particular stack of your Contentstack account.
Example
import * as contentstack from '@contentstack/management'
const client = contentstack.client()
const environment = {
     name: 'development',
     servers: [
               {
                 name: 'default'
               }
               ],
     urls: [
             {
                 locale: 'en-us',
                 url: 'http://example.com/'
             }
           ],
     deploy_content: true
}
client.stack({ api_key: 'api_key'}).environment().create({ environment })
.then((environment) => console.log(environment))
Returns:
Promise for Environment instance
Type
Promise.<Environment.Environment>

(static) query() → {Array.<Environment>}

Source:
The Query on GlobalField will allow to fetch details of all or specific GlobalField
Example
import * as contentstack from '@contentstack/management'
const client = contentstack.client()

client.stack({ api_key: 'api_key'}).environment().query({ query: { name: 'Environment Name' } }).find()
.then((globalFields) => console.log(globalFields))
Returns:
Array of GlobalField.
Type
Array.<Environment>