Release

Release

Source:
You can pin a set of entries and assets (along with the deploy action, i.e., publish/unpublish) to a ‘release’, and then deploy this release to an environment. This will publish/unpublish all the the items of the release to the specified environment. Read more about Releases.

Methods

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

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

const relase = {
    name: "Release Name",
    description: "2018-12-12",
    locked: false,
    archived: false
}

var release = client.stack({ api_key: 'api_key'}).release('release_uid')
Object.assign(release, cloneDeep(release))

release.update()
.then((release) => {
 release.title = 'My New release'
 release.description = 'Release description'
 return release.update()
})
.then((release) => console.log(release))
import * as contentstack from '@contentstack/management'
const client = contentstack.client()


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

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

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

client.stack({ api_key: 'api_key'}).release('release_uid').fetch()
.then((release) => console.log(release))
Returns:
Promise for Release instance
Type
Promise.<Release.Release>

(static) delete() → {Object}

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

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

(static) item() → {ReleaseItem}

Source:
A ReleaseItem is a set of entries and assets that needs to be deployed (published or unpublished) all at once to a particular environment.
Example
import * as contentstack from '@contentstack/management'
const client = contentstack.client()

client.stack({ api_key: 'api_key'}).release('release_uid').item().fetchAll()
.then((items) => console.log(items))
Returns:
Instance of ReleaseItem.
Type
ReleaseItem

(static) deploy(environments, locales, action, scheduledAt) → {Object}

Source:
The Deploy a Release request deploys a specific Release to specific environment(s) and locale(s).
Example
import * as contentstack from '@contentstack/management'
const client = contentstack.client()

client.stack({ api_key: 'api_key'}).release('release_uid').deploy({
     environments: [
                     "production",
                     "uat"
                     ],
     locales: [
                 "en-us",
                 "ja-jp"
              ],
     scheduledAt: '2018-12-12T13:13:13:122Z',
     action: 'publish',

})
.then((response) => console.log(response.notice))
Parameters:
Name Type Description
environments Array environment(s) on which the Release should be deployed.
locales Array locale(s) on which the Release should be deployed.
action String action on which the Release should be deployed.
scheduledAt String scheudle time for the Release to deploy.
Returns:
Response Object.
Type
Object

(static) clone(name, description) → {Promise.<Release.Release>}

Source:
The Clone a Release request allows you to clone (make a copy of) a specific Release in a stack.
Example
import * as contentstack from '@contentstack/management'
const client = contentstack.client()

client.stack({ api_key: 'api_key'}).release('release_uid').clone({ name: 'New Name', description: 'New Description'})
.then((release) => console.log(release))
Parameters:
Name Type Description
name String name of the cloned Release.
description String description of the cloned Release.
Returns:
Promise for Release instance
Type
Promise.<Release.Release>

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

Source:
The Create a Release request allows you to create a new Release in your stack. To add entries/assets to a Release, you need to provide the UIDs of the entries/assets in ‘items’ in the request body.
Example
import * as contentstack from '@contentstack/management'
const client = contentstack.client()
const release = {
       name: "Release Name",
       description: "2018-12-12",
       locked: false,
       archived: false
}
client.stack({ api_key: 'api_key'}).release().create({ release })
.then((release) => console.log(release))
Parameters:
Name Type Description
param.release Object Release details.
Returns:
Promise for Release instance
Type
Promise.<Release.Release>

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

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

client.stack({ api_key: 'api_key'}).release().query().find()
.then((release) => console.log(release))
Parameters:
Name Type Description
param.include_countThe Boolean ‘include_count’ parameter includes the count of total number of releases in your stack, along with the details of each release.
param.include_items_count Boolean The ‘include_items_count’ parameter returns the total number of items in a specific release.
param.limit Int The ‘limit’ parameter will return a specific number of releases in the output.
param.skip Int The ‘skip’ parameter will skip a specific number of releases in the response.
Returns:
Array of Release.
Type
Array.<Release>