Skip to content

Commit 3e1bbf6

Browse files
Merge pull request #10 from contentstack/doc-Hotfix3.5.1
Folder rename
2 parents 4da3270 + b41f3b5 commit 3e1bbf6

File tree

92 files changed

+227
-81
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+227
-81
lines changed

LICENSE.txt

100644100755
File mode changed.

config.js

100644100755
File mode changed.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

dist/.DS_Store

100644100755
File mode changed.

dist/nativescript/contentstack.js

100644100755
File mode changed.

dist/react-native/contentstack.js

100644100755
File mode changed.

dist/web/contentstack.js

100644100755
File mode changed.

docs-config.json

100644100755
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"opts": {
3-
"template": "csio-templates",
3+
"template": "contentstack-templates",
44
"encoding": "utf8",
55
"destination": "./js-sdk-reference/",
66
"recurse": true
@@ -19,6 +19,7 @@
1919
]
2020
},
2121
"tags": {
22-
"dictionaries": ["jsdoc", "closure"]
22+
"dictionaries": ["jsdoc", "closure"],
23+
"allowUnknownTags": true
2324
}
2425
}

examples/node/contentstack-demo.js

100644100755
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class ContentstackDemo {
2424
*/
2525
getEntries(contentTypeUid) {
2626
contentTypeUid = contentTypeUid || 'source'
27-
return this.Stack.ContentType(contentTypeUid).Query().toJSON().find()
27+
return this.Stack.ContentType(contentTypeUid).Query().includeReference('secondary_section.reference.reference').find()
2828
}
2929

3030

@@ -38,7 +38,7 @@ class ContentstackDemo {
3838
getEntry(contentTypeUid, entryUid) {
3939
contentTypeUid = contentTypeUid || 'source'
4040
entryUid = entryUid || 'blt123something'
41-
return this.Stack.ContentType(contentTypeUid).Entry(entryUid).fetch()
41+
return this.Stack.ContentType(contentTypeUid).Entry(entryUid).language('ja-jp').fetch()
4242
}
4343

4444
/**

examples/web/favicon.ico

100644100755
File mode changed.

examples/web/index.html

100644100755
File mode changed.

examples/web/scripts/contentstack.js

100644100755
File mode changed.

nativescript.js

100644100755
File mode changed.

package.json

100644100755
File mode changed.

react-native.js

100644100755
File mode changed.

src/core/cache-provider/index.js

100644100755
File mode changed.

src/core/cache-provider/localstorage.js

100644100755
File mode changed.

src/core/cache.js

100644100755
File mode changed.

src/core/contentstack.js

100644100755
Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
import Stack from "./stack";
22
import CacheProvider from './cache-provider/index';
33

4-
/**
5-
* @method Contentstack
6-
* @description Creates an instance of `Contentstack`.
7-
* @api public
8-
*/
4+
5+
/**
6+
* @class
7+
Contentstack
8+
* @description Creates an instance of `Contentstack`.
9+
* @instance
10+
*/
11+
912
class Contentstack {
1013

1114
constructor(){
1215
/**
13-
* @constant CachePolicy
16+
* @memberOf Contentstack
1417
* @description CachePolicy contains different cache policies constants.
1518
* @example
1619
* Contentstack.CachePolicy.IGNORE_CACHE
@@ -21,22 +24,10 @@ class Contentstack {
2124
*/
2225
this.CachePolicy = CacheProvider.policies;
2326
}
27+
/**
2428
25-
/**
26-
* @method Stack
27-
* @description Initialize an instance of ‘Stack’
28-
* @api public
29-
* @example
30-
*var Stack = Contentstack.Stack('api_key', 'delivery_token', 'environment');
31-
OR
32-
*var Stack = Contentstack.Stack({
33-
* 'api_key':'stack_api_key',
34-
* 'access_token':'stack_delivery_token',
35-
* 'environment':'environment_name'
36-
* });
37-
*
38-
* @returns {Stack}
39-
*/
29+
* @memberOf Contentstack
30+
*/
4031
Stack(...stack_arguments){
4132
return new Stack(...stack_arguments);
4233
}

src/core/lib/request.js

100644100755
File mode changed.

src/core/lib/utils.js

100644100755
File mode changed.

src/core/modules/assets.js

100644100755
Lines changed: 55 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,64 @@ import Stack from '../stack';
33
import Query from './query';
44

55
/**
6-
* @summary Creates an instance of 'Assets'.
7-
* @description An initializer is responsible for creating Asset object.
8-
* @param {String} uid - uid of the asset
9-
* @example
10-
* let Assets = Contentstack.Stack().Assets('bltsomething123');
11-
* @returns {Assets}
12-
* @ignore
13-
*/
6+
* @class
7+
Assets
8+
* @summary Creates an instance of `Assets`.
9+
* @description Retrieves the asset based on the specified UID
10+
* @param {String} uid - uid of asset you want to retrieve
11+
* @example
12+
* let data = Stack.Assets('bltsomething123').toJSON().fetch()
13+
* data
14+
* .then(function(result) {
15+
* // ‘result’ is a single asset object of specified uid
16+
* }, function(error) {
17+
* // error function
18+
* })
19+
* @returns {Assets}
20+
* @instance
21+
*/
22+
1423
export default class Assets {
1524
constructor() {
1625
this._query = {};
1726
this.only = Utils.transform('only');
1827
return this;
1928
}
2029

21-
30+
/**
31+
* Converts your response into plain JavasScript object
32+
* @memberOf Assets
33+
* @example var Query = Stack.ContentType('blog').Query()
34+
Query
35+
.toJSON()
36+
.find()
37+
.then(function (result) {
38+
// 'result' is an object which content the data in json object form
39+
},function (error) {
40+
// error function
41+
})
42+
* @returns {Assets}
43+
* @instance
44+
*/
45+
2246
toJSON() {
2347
this.tojson = true;
2448
return this;
2549
}
2650

27-
51+
/**
52+
* Includes query parameters in your queries.
53+
* @memberOf Assets
54+
* @example var data = Stack.Assets(assetUid).addParam('include_dimension', 'true').toJSON().fetch()
55+
* data.then(function (result) {
56+
* // 'result' is an object which content the data including count in json object form
57+
* },function (error) {
58+
* // error function
59+
* })
60+
* @returns {Assets}
61+
* @instance
62+
*/
63+
2864
addParam(key, value) {
2965
if (key && typeof key === 'string' && value && typeof value === 'string') {
3066
this._query[key] = value;
@@ -34,7 +70,15 @@ export default class Assets {
3470
}
3571
}
3672

37-
73+
74+
/**
75+
* Fetches a particular asset based on the provided asset UID.
76+
* @memberOf Assets
77+
* @example
78+
* Stack.Assets('assets_uid').toJSON().fetch()
79+
* @returns {promise}
80+
* @instance
81+
*/
3882

3983
fetch() {
4084
if (this.asset_uid) {
@@ -47,7 +91,6 @@ export default class Assets {
4791
query: this._query
4892
}
4993
}
50-
5194
return Utils.sendRequest(this);
5295
} else {
5396
console.error("Kindly provide an asset uid. e.g. .Assets('bltsomething123')");

0 commit comments

Comments
 (0)