Skip to content

Commit c2c9e31

Browse files
Merge pull request #18 from contentstack/multiple-ct-reference
Support Multi-ContentType reference feature
2 parents 7c47a3a + 6e11a1b commit c2c9e31

File tree

11 files changed

+1863
-897
lines changed

11 files changed

+1863
-897
lines changed

dist/nativescript/contentstack.js

Lines changed: 848 additions & 437 deletions
Large diffs are not rendered by default.

dist/node/contentstack.js

Lines changed: 89 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -906,9 +906,16 @@ var Stack = function () {
906906
/**
907907
* @method fetch
908908
* @memberOf Stack
909-
* @param {String} uid - uid of the entry
910-
* @description An initializer is responsible for creating Entry object
911-
* @returns {Entry}
909+
* @description This method returns the complete information of a specific content type.
910+
* @example
911+
* let single_contenttype = Stack.ContentType(content_type_uid).fetch()
912+
* single_contenttype
913+
* .then(function(result) {
914+
* // 'result' is a single contentType information.
915+
* }).catch((error) => {
916+
* console.log(error)
917+
* });
918+
* @returns {ContentType}
912919
* @instance
913920
*/
914921

@@ -931,7 +938,23 @@ var Stack = function () {
931938
* @method Assets
932939
* @memberOf Stack
933940
* @param {String} uid - uid of the asset
934-
* @description Retrieves the asset based on the specified UID
941+
* @description Retrieves all assets of a stack by default. To retrieve a single asset, specify its UID.
942+
* @example
943+
* let data = Stack.Assets('bltsomething123').toJSON().fetch()
944+
* data
945+
* .then(function(result) {
946+
* // ‘result’ is a single asset object of specified uid
947+
* }, function(error) {
948+
* // error function
949+
* })
950+
* @example
951+
* let data = Stack.Assets().toJSON().find()
952+
* data
953+
* .then(function(result) {
954+
* // ‘result’ will display all assets present in stack
955+
* }, function(error) {
956+
* // error function
957+
* })
935958
* @returns {Assets}
936959
* @instance
937960
*/
@@ -999,10 +1022,10 @@ var Stack = function () {
9991022
/**
10001023
* @method getContentTypes
10011024
* @memberOf Stack
1002-
* @description getContentTypes get all the ContentTypes.
1025+
* @description This method returns comprehensive information of all the content types of a particular stack in your account.
10031026
* @example Stack.getContentTypes()
10041027
* @example
1005-
* let data = Stack.getLastActivites()
1028+
* let data = Stack.getContentTypes()
10061029
* data
10071030
* .then(function(result) {
10081031
* // 'result' is list of contentTypes.
@@ -1535,7 +1558,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
15351558
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
15361559

15371560
//JS SDK version
1538-
var version = '3.5.2';
1561+
var version = '3.7.0';
15391562
var environment = void 0,
15401563
api_key = void 0;
15411564

@@ -1979,6 +2002,31 @@ var Entry = function () {
19792002
return this;
19802003
}
19812004

2005+
/**
2006+
* @method includeReferenceContentTypeUid
2007+
* @memberOf Entry
2008+
* @description This method also includes the content type UIDs of the referenced entries returned in the response.
2009+
* @example Stack.ContentType("contentType_uid").Entry("entry_uid").includeReferenceContentTypeUID().fetch()
2010+
* @example
2011+
* Query = Stack.ContentType("contentType_uid").Entry("entry_uid").includeReferenceContentTypeUID().fetch()
2012+
* Query
2013+
* .toJSON()
2014+
* .then(function (result) {
2015+
* let value = result.get(field_uid)
2016+
* },function (error) {
2017+
* // error function
2018+
* })
2019+
* @returns {Entry}
2020+
* @instance
2021+
*/
2022+
2023+
}, {
2024+
key: "includeReferenceContentTypeUID",
2025+
value: function includeReferenceContentTypeUID() {
2026+
this._query['include_reference_content_type_uid'] = true;
2027+
return this;
2028+
}
2029+
19822030
/**
19832031
* @method includeContentType
19842032
* @memberOf Entry
@@ -2646,6 +2694,30 @@ var Query = function (_Entry) {
26462694
}
26472695
}
26482696

2697+
/**
2698+
* @method includeReferenceContentTypeUid
2699+
* @memberOf Query
2700+
* @description This method also includes the content type UIDs of the referenced entries returned in the response.
2701+
* @example Stack.ContentType("contentType_uid").Query().includeReferenceContentTypeUID().find()
2702+
* @example
2703+
* let blogQuery = Stack.ContentType("contentType_uid").Query();
2704+
* let data = blogQuery.includeReferenceContentTypeUID().find()
2705+
* data.then(function(result) {
2706+
* // ‘result’ contains a list of entries in which content type UIDs is present.
2707+
* },function (error) {
2708+
* // error function
2709+
* })
2710+
* @returns {Query}
2711+
* @instance
2712+
*/
2713+
2714+
}, {
2715+
key: 'includeReferenceContentTypeUID',
2716+
value: function includeReferenceContentTypeUID() {
2717+
this._query['include_reference_content_type_uid'] = true;
2718+
return this;
2719+
}
2720+
26492721
/**
26502722
* @method includeCount
26512723
* @memberOf Query
@@ -2832,6 +2904,7 @@ var Query = function (_Entry) {
28322904
query: this._query
28332905
}
28342906
};
2907+
28352908
return Utils.sendRequest(this);
28362909
}
28372910
}]);
@@ -7563,7 +7636,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
75637636
* @class
75647637
Assets
75657638
* @summary Creates an instance of `Assets`.
7566-
* @description Retrieves the asset based on the specified UID
7639+
* @description Retrieves all assets of a stack by default. To retrieve a single asset, specify its UID.
75677640
* @param {String} uid - uid of asset you want to retrieve
75687641
* @example
75697642
* let data = Stack.Assets('bltsomething123').toJSON().fetch()
@@ -7573,6 +7646,14 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
75737646
* }, function(error) {
75747647
* // error function
75757648
* })
7649+
* @example
7650+
* let data = Stack.Assets().toJSON().find()
7651+
* data
7652+
* .then(function(result) {
7653+
* // ‘result’ will display all assets present in stack
7654+
* }, function(error) {
7655+
* // error function
7656+
* })
75767657
* @returns {Assets}
75777658
* @instance
75787659
*/

0 commit comments

Comments
 (0)