Skip to content

Commit ddc2a3d

Browse files
Rohit MishraRohit Mishra
authored andcommitted
updated in reference folder
1 parent 33091aa commit ddc2a3d

File tree

2 files changed

+58
-3
lines changed

2 files changed

+58
-3
lines changed

dist/react-native/contentstack.js

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -899,6 +899,7 @@ function Request(options) {
899899
return new Promise(function (resolve, reject) {
900900
var queryParams = void 0;
901901
var serialize = function serialize(obj, prefix) {
902+
902903
var str = [],
903904
p = void 0;
904905
if ((typeof obj === "undefined" ? "undefined" : _typeof(obj)) === "object" && obj.length !== undefined) {
@@ -909,7 +910,7 @@ function Request(options) {
909910
for (p in obj) {
910911
var k = prefix ? prefix + "[" + p + "]" : p,
911912
v = obj[p];
912-
str.push(v !== null && (typeof v === "undefined" ? "undefined" : _typeof(v)) === "object" && p !== 'query' ? serialize(v, k) : k + "=" + (p !== 'query' ? encodeURIComponent(v) : JSON.stringify(v)));
913+
str.push(v !== null && (typeof v === "undefined" ? "undefined" : _typeof(v)) === "object" && p !== 'query' ? serialize(v, k) : k + "=" + encodeURIComponent(p !== 'query' ? v : JSON.stringify(v)));
913914
}
914915
}
915916
return str.join("&");
@@ -1287,6 +1288,23 @@ var Entry = function () {
12871288
return this;
12881289
}
12891290

1291+
/**
1292+
* @method AddParam
1293+
* @description This method includes query parameter in query.
1294+
* @example blogQuery.addParam('include_count', 'true').fetch()
1295+
*/
1296+
1297+
}, {
1298+
key: "addParam",
1299+
value: function addParam(key, value) {
1300+
if (key && value && typeof key === 'string' && typeof value === 'string') {
1301+
this._query[key] = value;
1302+
return this;
1303+
} else {
1304+
console.error("Kindly provide valid parameters.");
1305+
}
1306+
}
1307+
12901308
/**
12911309
* @method fetch
12921310
* @description fetch entry of requested content_type of defined query if present.
@@ -1744,6 +1762,24 @@ var Query = function (_Entry) {
17441762
return this;
17451763
}
17461764

1765+
/**
1766+
* @method AddParam
1767+
* @description This method includes query parameter in query.
1768+
* @example blogQuery.addParam('include_count', 'true')
1769+
* @returns {Query}
1770+
*/
1771+
1772+
}, {
1773+
key: 'addParam',
1774+
value: function addParam(key, value) {
1775+
if (key && value && typeof key === 'string' && typeof value === 'string') {
1776+
this._query[key] = value;
1777+
return this;
1778+
} else {
1779+
console.error("Kindly provide valid parameters.");
1780+
}
1781+
}
1782+
17471783
/**
17481784
* @method getQuery
17491785
* @summary returns the raw query which can be used for futher calls(.and/.or).
@@ -2385,6 +2421,7 @@ var Assets = function () {
23852421
function Assets() {
23862422
_classCallCheck(this, Assets);
23872423

2424+
this._query = {};
23882425
/**
23892426
* @method only
23902427
* @description This method is use to show the selected fields of the assets in resultset.
@@ -2441,6 +2478,23 @@ var Assets = function () {
24412478
return this;
24422479
}
24432480

2481+
/**
2482+
* @method AddParam
2483+
* @description This method includes query parameter in query.
2484+
* @example Stack.Assets('bltsomething123').addParam('include_dimension', 'true').fetch()
2485+
*/
2486+
2487+
}, {
2488+
key: 'addParam',
2489+
value: function addParam(key, value) {
2490+
if (key && typeof key === 'string' && value && typeof value === 'string') {
2491+
this._query[key] = value;
2492+
return this;
2493+
} else {
2494+
console.error("Kindly provide a valid parameters.");
2495+
}
2496+
}
2497+
24442498
/**
24452499
* @method fetch
24462500
* @description fetch asset obhect of requested Asset uid of defined query if present.
@@ -2461,6 +2515,7 @@ var Assets = function () {
24612515
query: this._query
24622516
}
24632517
};
2518+
24642519
return Utils.sendRequest(this);
24652520
} else {
24662521
console.error("Kindly provide an asset uid. e.g. .Assets('bltsomething123')");

0 commit comments

Comments
 (0)