File tree Expand file tree Collapse file tree 5 files changed +74
-5
lines changed Expand file tree Collapse file tree 5 files changed +74
-5
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " contentstack" ,
3
- "version" : " 3.6 .0" ,
3
+ "version" : " 3.7 .0" ,
4
4
"description" : " Contentstack Javascript SDK" ,
5
5
"homepage" : " https://www.contentstack.com/" ,
6
6
"author" : {
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import Query from './query';
6
6
* @class
7
7
Assets
8
8
* @summary Creates an instance of `Assets`.
9
- * @description Retrieves the asset based on the specified UID
9
+ * @description Retrieves all assets of a stack by default. To retrieve a single asset, specify its UID.
10
10
* @param {String } uid - uid of asset you want to retrieve
11
11
* @example
12
12
* let data = Stack.Assets('bltsomething123').toJSON().fetch()
@@ -16,6 +16,14 @@ import Query from './query';
16
16
* }, function(error) {
17
17
* // error function
18
18
* })
19
+ * @example
20
+ * let data = Stack.Assets().toJSON().find()
21
+ * data
22
+ * .then(function(result) {
23
+ * // ‘result’ will display all assets present in stack
24
+ * }, function(error) {
25
+ * // error function
26
+ * })
19
27
* @returns {Assets }
20
28
* @instance
21
29
*/
Original file line number Diff line number Diff line change @@ -193,6 +193,29 @@ export default class Entry {
193
193
return this ;
194
194
}
195
195
196
+ /**
197
+ * @method includeReferenceContentTypeUid
198
+ * @memberOf Entry
199
+ * @description This method also includes the content type UIDs of the referenced entries returned in the response.
200
+ * @example Stack.ContentType("contentType_uid").Entry("entry_uid").includeReferenceContentTypeUID().fetch()
201
+ * @example
202
+ * Query = Stack.ContentType("contentType_uid").Entry("entry_uid").includeReferenceContentTypeUID().fetch()
203
+ * Query
204
+ * .toJSON()
205
+ * .then(function (result) {
206
+ * let value = result.get(field_uid)
207
+ * },function (error) {
208
+ * // error function
209
+ * })
210
+ * @returns {Entry }
211
+ * @instance
212
+ */
213
+ includeReferenceContentTypeUID ( ) {
214
+ this . _query [ 'include_reference_content_type_uid' ] = true ;
215
+ return this ;
216
+ }
217
+
218
+
196
219
/**
197
220
* @method includeContentType
198
221
* @memberOf Entry
Original file line number Diff line number Diff line change @@ -497,6 +497,28 @@ export default class Query extends Entry {
497
497
}
498
498
}
499
499
500
+ /**
501
+ * @method includeReferenceContentTypeUid
502
+ * @memberOf Query
503
+ * @description This method also includes the content type UIDs of the referenced entries returned in the response.
504
+ * @example Stack.ContentType("contentType_uid").Query().includeReferenceContentTypeUID().find()
505
+ * @example
506
+ * let blogQuery = Stack.ContentType("contentType_uid").Query();
507
+ * let data = blogQuery.includeReferenceContentTypeUID().find()
508
+ * data.then(function(result) {
509
+ * // ‘result’ contains a list of entries in which content type UIDs is present.
510
+ * },function (error) {
511
+ * // error function
512
+ * })
513
+ * @returns {Query }
514
+ * @instance
515
+ */
516
+ includeReferenceContentTypeUID ( ) {
517
+ this . _query [ 'include_reference_content_type_uid' ] = true ;
518
+ return this ;
519
+ }
520
+
521
+
500
522
/**
501
523
* @method includeCount
502
524
* @memberOf Query
@@ -530,7 +552,6 @@ export default class Query extends Entry {
530
552
* @returns {Query }
531
553
* @instance
532
554
*/
533
-
534
555
addParam ( key , value ) {
535
556
if ( key && value && typeof key === 'string' && typeof value === 'string' ) {
536
557
this . _query [ key ] = value ;
@@ -595,7 +616,7 @@ export default class Query extends Entry {
595
616
* })
596
617
* @returns {Query }
597
618
* @instance
598
- */
619
+ */
599
620
search ( value ) {
600
621
if ( value && typeof value === 'string' ) {
601
622
this . _query [ 'typeahead' ] = value ;
@@ -663,6 +684,7 @@ export default class Query extends Entry {
663
684
query : this . _query
664
685
}
665
686
} ;
687
+
666
688
return Utils . sendRequest ( this ) ;
667
689
}
668
690
Original file line number Diff line number Diff line change @@ -282,7 +282,23 @@ export default class Stack {
282
282
* @method Assets
283
283
* @memberOf Stack
284
284
* @param {String } uid - uid of the asset
285
- * @description Retrieves the asset based on the specified UID
285
+ * @description Retrieves all assets of a stack by default. To retrieve a single asset, specify its UID.
286
+ * @example
287
+ * let data = Stack.Assets('bltsomething123').toJSON().fetch()
288
+ * data
289
+ * .then(function(result) {
290
+ * // ‘result’ is a single asset object of specified uid
291
+ * }, function(error) {
292
+ * // error function
293
+ * })
294
+ * @example
295
+ * let data = Stack.Assets().toJSON().find()
296
+ * data
297
+ * .then(function(result) {
298
+ * // ‘result’ will display all assets present in stack
299
+ * }, function(error) {
300
+ * // error function
301
+ * })
286
302
* @returns {Assets }
287
303
* @instance
288
304
*/
You can’t perform that action at this time.
0 commit comments