Skip to content

Commit 83fc1a6

Browse files
Merge pull request #9 from contentstack/doc-Hotfix3.5.1
Js Sdk Reference doc Updated
2 parents ea51f85 + e461bc5 commit 83fc1a6

File tree

7 files changed

+421
-284
lines changed

7 files changed

+421
-284
lines changed

package.json

Lines changed: 80 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,84 @@
11
{
2-
"name": "contentstack",
3-
"version": "3.5.0",
4-
"description": "Contentstack Javascript SDK",
5-
"homepage": "https://www.contentstack.com/",
6-
"author": {
7-
"name": "Contentstack",
8-
"url": "https://www.contentstack.com/"
2+
"name": "contentstack",
3+
"version": "3.5.1",
4+
"description": "Contentstack Javascript SDK",
5+
"homepage": "https://www.contentstack.com/",
6+
"author": {
7+
"name": "Contentstack",
8+
"url": "https://www.contentstack.com/"
9+
},
10+
"main": "dist/node/contentstack.js",
11+
"browser": "dist/web/contentstack.js",
12+
13+
"scripts": {
14+
"test": "node test.js",
15+
"buildnode": "webpack --config webpack/webpack.node.js",
16+
"buildweb": "webpack -p --config webpack/webpack.web.js",
17+
"buildreactnative": "webpack --config webpack/webpack.react-native.js",
18+
"buildnativescript": "webpack --config webpack/webpack.nativescript.js",
19+
"buildall": "npm run buildnode&npm run buildweb&npm run buildreactnative&npm run buildnativescript",
20+
"generate-docs": "node_modules/.bin/jsdoc --configure docs-config.json --verbose"
21+
},
22+
"repository": {
23+
"type": "git",
24+
"url": "https://github.com/builtio-contentstack/contentstack-javascript.git"
25+
},
26+
"_shasum": "a328ed07240476a26b31a23261355dc929e1da63",
27+
"_from": "contentstack@latest",
28+
"_npmVersion": "3.8.9",
29+
"_nodeVersion": "6.2.0",
30+
"_npmUser": {
31+
"name": "mynk",
32+
"email": "[email protected]"
33+
},
34+
"maintainers": [
35+
{
36+
"name": "hiteshbal",
37+
"email": "[email protected]"
938
},
10-
"main": "dist/node/contentstack.js",
11-
"browser": "dist/web/contentstack.js",
12-
13-
"scripts": {
14-
"test": "node test.js",
15-
"buildnode": "webpack --config webpack/webpack.node.js",
16-
"buildweb": "webpack -p --config webpack/webpack.web.js",
17-
"buildreactnative": "webpack --config webpack/webpack.react-native.js",
18-
"buildnativescript": "webpack --config webpack/webpack.nativescript.js",
19-
"buildall": "npm run buildnode&npm run buildweb&npm run buildreactnative&npm run buildnativescript",
20-
"generate-docs": "node_modules/.bin/jsdoc --configure docs-config.json --verbose"
21-
},
22-
"repository": {
23-
"type": "git",
24-
"url": "https://github.com/builtio-contentstack/contentstack-javascript.git"
25-
},
26-
"_shasum": "a328ed07240476a26b31a23261355dc929e1da63",
27-
"_from": "contentstack@latest",
28-
"_npmVersion": "3.8.9",
29-
"_nodeVersion": "6.2.0",
30-
"_npmUser": {
31-
"name": "mynk",
32-
"email": "[email protected]"
33-
},
34-
"maintainers": [
35-
{
36-
"name": "hiteshbal",
37-
"email": "[email protected]"
38-
},
39-
{
40-
"name": "mynk",
41-
"email": "[email protected]"
42-
}
43-
],
44-
"dist": {
45-
"shasum": "a328ed07240476a26b31a23261355dc929e1da63",
46-
"tarball": "https://registry.npmjs.org/contentstack/-/contentstack-3.0.0.tgz"
47-
},
48-
"license": "MIT",
49-
"directories": {},
50-
"_resolved": "https://registry.npmjs.org/contentstack/-/contentstack-3.0.0.tgz",
51-
"_npmOperationalInternal": {
52-
"host": "packages-18-east.internal.npmjs.com",
53-
"tmp": "tmp/contentstack-3.0.0.tgz_1477830884275_0.9869455888401717"
54-
},
55-
"devDependencies": {
56-
"babel-core": "6.26.0",
57-
"babel-loader": "7.1.2",
58-
"babel-plugin-transform-runtime": "6.23.0",
59-
"babel-preset-env": "1.6.1",
60-
"babel-preset-es2015": "6.24.1",
61-
"babel-preset-es2016": "6.24.1",
62-
"babel-preset-stage-1": "6.24.1",
63-
"babel-runtime": "6.26.0",
64-
"compression-webpack-plugin": "1.0.1",
65-
"es3ify-loader": "0.2.0",
66-
"jsdoc": "3.5.5",
67-
"jshint": "2.9.5",
68-
"nodemailer": "^4.3.1",
69-
"request": "^2.83.0",
70-
"string-replace-loader": "1.3.0",
71-
"string-replace-webpack-plugin": "0.1.3",
72-
"tap-json": "1.0.0",
73-
"tape": "4.8.0",
74-
"uglify-js": "2.8.29",
75-
"webpack": "2.7.0",
76-
"webpack-md5-hash": "0.0.5",
77-
"webpack-merge": "4.1.0"
78-
},
79-
"dependencies": {
80-
"es6-promise": "4.1.1",
81-
"isomorphic-fetch": "2.2.1",
82-
"localStorage": "1.0.3"
39+
{
40+
"name": "mynk",
41+
"email": "[email protected]"
8342
}
43+
],
44+
"dist": {
45+
"shasum": "a328ed07240476a26b31a23261355dc929e1da63",
46+
"tarball": "https://registry.npmjs.org/contentstack/-/contentstack-3.0.0.tgz"
47+
},
48+
"license": "MIT",
49+
"directories": {},
50+
"_resolved": "https://registry.npmjs.org/contentstack/-/contentstack-3.0.0.tgz",
51+
"_npmOperationalInternal": {
52+
"host": "packages-18-east.internal.npmjs.com",
53+
"tmp": "tmp/contentstack-3.0.0.tgz_1477830884275_0.9869455888401717"
54+
},
55+
"devDependencies": {
56+
"babel-core": "6.26.0",
57+
"babel-loader": "7.1.2",
58+
"babel-plugin-transform-runtime": "6.23.0",
59+
"babel-preset-env": "1.6.1",
60+
"babel-preset-es2015": "6.24.1",
61+
"babel-preset-es2016": "6.24.1",
62+
"babel-preset-stage-1": "6.24.1",
63+
"babel-runtime": "6.26.0",
64+
"compression-webpack-plugin": "1.0.1",
65+
"es3ify-loader": "0.2.0",
66+
"jsdoc": "^3.5.5",
67+
"jshint": "2.9.5",
68+
"nodemailer": "^4.3.1",
69+
"request": "^2.83.0",
70+
"string-replace-loader": "1.3.0",
71+
"string-replace-webpack-plugin": "0.1.3",
72+
"tap-json": "1.0.0",
73+
"tape": "4.8.0",
74+
"uglify-js": "2.8.29",
75+
"webpack": "2.7.0",
76+
"webpack-md5-hash": "0.0.5",
77+
"webpack-merge": "4.1.0"
78+
},
79+
"dependencies": {
80+
"es6-promise": "4.1.1",
81+
"isomorphic-fetch": "2.2.1",
82+
"localStorage": "1.0.3"
83+
}
8484
}

src/core/contentstack.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,19 @@ class Contentstack {
2424

2525
/**
2626
* @method Stack
27-
* @description Initialize "Built.io Contentstack" Stack javascript-SDK instance
27+
* @description Initialize an instance of ‘Stack’
2828
* @api public
2929
* @example
30-
* var Stack = Contentstack.Stack('api_key', 'access_token', 'environment');
31-
* OR
32-
* var Stack = Contentstack.Stack({
33-
* 'api_key':'bltsomethingapikey',
34-
* 'access_token':'bltsomethongtoken',
35-
* 'environment':'environment_name'
36-
* });
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+
* });
3737
*
3838
* @returns {Stack}
39-
*/
39+
*/
4040
Stack(...stack_arguments){
4141
return new Stack(...stack_arguments);
4242
}

src/core/modules/assets.js

Lines changed: 6 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Stack from '../stack';
33
import Query from './query';
44

55
/**
6-
* @summary Creates an instance of `Assets`.
6+
* @summary Creates an instance of 'Assets'.
77
* @description An initializer is responsible for creating Asset object.
88
* @param {String} uid - uid of the asset
99
* @example
@@ -13,50 +13,18 @@ import Query from './query';
1313
*/
1414
export default class Assets {
1515
constructor() {
16-
this._query = {};
17-
/**
18-
* @method only
19-
* @description This method is use to show the selected fields of the assets in resultset.
20-
* @param {String} [key=BASE] - single field in asset
21-
* @param {Array} values - array of fields to be show in resultset
22-
* @example
23-
* <caption> .only with field uid </caption>
24-
* Assets().only('title')
25-
* @example
26-
* <caption> .only with field uid </caption>
27-
* Assets().only('BASE','title')
28-
* @example
29-
* <caption> .only with field uids(array) </caption>
30-
* Assets().only(['title','description'])
31-
* @returns {Asset}
32-
*/
16+
this._query = {};
3317
this.only = Utils.transform('only');
3418
return this;
3519
}
3620

37-
/**
38-
* @method toJSON
39-
* @description This method is used to convert the result in to plain javascript object.
40-
* @example
41-
* assetQuery
42-
* .toJSON()
43-
* .then(function (result) {
44-
* let value = result.get(field_uid)
45-
* },function (error) {
46-
* // error function
47-
* })
48-
* @returns {Object}
49-
*/
21+
5022
toJSON() {
5123
this.tojson = true;
5224
return this;
5325
}
5426

55-
/**
56-
* @method AddParam
57-
* @description This method includes query parameter in query.
58-
* @example Stack.Assets('bltsomething123').addParam('include_dimension', 'true').fetch()
59-
*/
27+
6028
addParam(key, value) {
6129
if (key && typeof key === 'string' && value && typeof value === 'string') {
6230
this._query[key] = value;
@@ -66,12 +34,8 @@ export default class Assets {
6634
}
6735
}
6836

69-
/**
70-
* @method fetch
71-
* @description fetch asset obhect of requested Asset uid of defined query if present.
72-
* @example
73-
* Stack.Assets('bltsomething123').fetch()
74-
*/
37+
38+
7539
fetch() {
7640
if (this.asset_uid) {
7741
this.requestParams = {

0 commit comments

Comments
 (0)