Methods
(static) create(payload) → {external:Promise}
- Source:
- See:
This method creates a new entry.
Example
extension.stack.ContentType('content_type_uid').Entry.create({
"entry": {
"title": "example",
"url": "/example"
}
}).then(...).catch(...);
Parameters:
Name | Type | Description |
---|---|---|
payload |
Object | Data to create an entry |
Returns:
Required data if resolved successfully
- Type
- external:Promise
(static) Query() → {Query}
- Source:
This static method instantiates the query module for entries. To see the list of methods that can be used for querying entries, refer the
Query
module.
Example
let entryQuery = extension.stack.ContentType('content_type_uid').Entry.Query();
entryQuery.where("field_uid": "10").limit(10).skip(10).find().then(...).catch(...);
Returns:
- Type
- Query
addParam(key, value) → {Stack#ContentType#Entry}
- Source:
This method includes a query parameter in your query.
Example
extension.stack.ContentType('content_type_uid').Entry('uid').addParam('include_count', 'true').fetch().then().catch();
Parameters:
Name | Type | Description |
---|---|---|
key |
string | Key of the parameter |
value |
string | Value of the parameter |
Returns:
Returns
addQuery(key, value) → {Stack#ContentType#Entry}
- Source:
This method is used to add a query to an entry object.
Example
extension.stack.ContentType('contenttype_uid').Entry('bltsomething123').addQuery('include_schema',true).fetch()
Parameters:
Name | Type | Description |
---|---|---|
key |
String | Key of the query |
value |
String | Value of the query |
Returns:
delete() → {external:Promise}
- Source:
- See:
This method deletes an existing entry.
Example
extension.stack.ContentType('content_type_uid').Entry('uid').delete().then().catch();
Returns:
Required data if resolved successfully
- Type
- external:Promise
environment(environment_uid) → {Stack#ContentType#Entry}
- Source:
This method is used to set the environment name of which you want to retrieve the data.
Example
extension.stack.ContentType('contenttype_uid').Entry('bltsomething123').environment('development').fetch()
Parameters:
Name | Type | Description |
---|---|---|
environment_uid |
String | UID/Name of environment |
Returns:
except(keyopt, values) → {Stack#ContentType#Entry}
- Source:
This method is used to hide the selected fields of an entry in the result set.
Examples
Except with field uid
extension.stack.ContentType('content_type_uid').Entry('bltsomething123').except('title').fetch();
Except with field uid
extension.stack.ContentType('content_type_uid').Entry('bltsomething123').except('BASE','title').fetch();
Except with field uids(array)
extension.stack.ContentType('content_type_uid').Entry('bltsomething123').except(['title','description']).fetch();
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
key |
String |
<optional> |
BASE
|
Single field of an entry |
values |
Array | Array of fields to be hidden in the result set |
Returns:
fetch() → {external:Promise}
- Source:
- See:
This method fetches information of a specific entry.
Example
extension.stack.ContentType('content_type_uid').Entry('uid').fetch().then().catch();
Returns:
Required data if resolved successfully
- Type
- external:Promise
getLanguages() → {external:Promise}
- Source:
This method returns the details of all the languages that an entry is localized in.
Example
extension.stack.ContentType('contenttype_uid').Entry('bltsomething123').getLanguages()
Returns:
- Type
- external:Promise
getReferences() → {external:Promise}
- Source:
- See:
This method will fetch all the entries in which the current entry is referenced.
Example
extension.stack.ContentType('content_type_uid').Entry('uid').getReferences().then().catch();
Returns:
Required data if resolved successfully
- Type
- external:Promise
includeContentType() → {Stack#ContentType#Entry}
- Source:
This method is used to include the current content type in the result set along with the entry(ies).
Example
extension.stack.ContentType('contenttype_uid').Entry('bltsomething123').includeContentType().fetch()
Returns:
includeOwner() → {Stack#ContentType#Entry}
- Source:
This method is used to include the owner of the entry(ies) in the result set.
Example
extension.stack.ContentType('contenttype_uid').Entry('bltsomething123').includeOwner().fetch()
Returns:
includeReference() → {Stack#ContentType#Entry}
- Source:
This method is used to include referenced entries from other content types.
Examples
.includeReference with reference_field_uids as array
stack.ContentType('contenttype_uid').Entry('bltsomething123').includeReference(['category', 'author']).fetch()
.includeReference with reference_field_uids
stack.ContentType('contenttype_uid').Entry('bltsomething123').includeReference('category', 'author').fetch()
Returns:
includeSchema() → {Stack#ContentType#Entry}
- Source:
This method is used to include the schema of the current contenttype in result set along with the entry/entries.
Example
extension.stack.ContentType('contenttype_uid').Entry('bltsomething123').includeSchema().fetch()
Returns:
language(languageCode) → {Stack#ContentType#Entry}
- Source:
This method is used to set the language code of which you want to retrieve the data.
Example
extension.stack.ContentType('contenttype_uid').Entry('bltsomething123').language('en-us').fetch()
Parameters:
Name | Type | Description |
---|---|---|
languageCode |
String | Language code, for e.g. 'en-us', 'ja-jp', and so on |
Returns:
only(keyopt, values) → {Stack#ContentType#Entry}
- Source:
This method is used to show the selected fields of an entry in the result set.
Examples
Only with field UID
extension.stack.ContentType('content_type_uid').Entry('bltsomething123').only('title').fetch();
Only with field UID
extension.stack.ContentType('content_type_uid').Entry('bltsomething123').only('BASE','title').fetch();
Only with field UIDs(array)
extension.stack.ContentType('content_type_uid').Entry('bltsomething123').only(['title','description']).fetch();
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
key |
String |
<optional> |
BASE
|
Single field of an entry |
values |
Array | Array of fields to be shown in the result set |
Returns:
publish(payload) → {external:Promise}
- Source:
This method lets you publish an entry either immediately or schedule it to be published automatically at a later date/time.
Example
extension.stack.ContentType('contenttype_uid').Entry('bltsomething123').publish({
"entry": {
"environments": ["development"],
"locales": ["en-us"]
},
"locale": "en-us",
"version": 1,
"scheduled_at": "2019-02-14T18:30:00.000Z"
}).then(...).catch(...);
Parameters:
Name | Type | Description |
---|---|---|
payload |
object | Payload for the request |
Returns:
- Type
- external:Promise
setWorkflowStage(payload) → {external:Promise}
- Source:
This method allows you to either set a particular workflow stage or update the workflow stage details of an entry.
Example
extension.stack.ContentType('contenttype_uid').Entry('bltsomething123').setWorkflowStage({
"workflow": {
"workflow_stage": {
"comment": "Test Comment",
"due_date": "Thu Dec 01 2018",
"notify": false,
"uid": "blt9f52a2cd5e0014fb",
"assigned_to": [{
"uid": "blt296a22e28cc0c63c",
"name": "John Doe",
"email": "john.doe@contentstack.com"
}],
"assigned_by_roles": [{
"uid": "blt5b74c24c7ae25d94",
"name": "Content Manager"
}]
}
}
}).then(...).catch(...);
Parameters:
Name | Type | Description |
---|---|---|
payload |
object | Payload for the request |
Returns:
- Type
- external:Promise
unlocalize(locale) → {external:Promise}
- Source:
This method is used to unlocalize an entry
Example
extension.stack.ContentType('contenttype_uid').Entry('bltsomething123').unlocalize('fr-fr').then(...).catch(...);
Parameters:
Name | Type | Description |
---|---|---|
locale |
string | Locale in which the entry has to be unlocalized |
Returns:
- Type
- external:Promise
unpublish(payload) → {external:Promise}
- Source:
This method lets you publish an entry either immediately or schedule it to be published automatically at a later date/time.
Example
extension.stack.ContentType('contenttype_uid').Entry('bltsomething123').unpublish({
"entry": {
"environments": ["development"],
"locales": ["en-us"]
},
"locale": "en-us",
"version": 1,
"scheduled_at": "2019-02-14T18:30:00.000Z"
}).then(...).catch(...);
Parameters:
Name | Type | Description |
---|---|---|
payload |
object | Payload for the request |
Returns:
- Type
- external:Promise
update(payload, localeopt) → {external:Promise}
- Source:
- See:
This call allows you to update entry content.
Example
extension.stack.ContentType('contenttype_uid').Entry('bltsomething123').update(
{
"entry": {
"title": "example",
"url": "/example"
}
}).then(...).catch(...);
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
payload |
object | Payload for the request | |
locale |
string |
<optional> |
Passing the ‘locale’ parameter will localize the entry in the specified locale to be localized in the specified locale. |
Returns:
- Type
- external:Promise