Skip to content

Commit de0c2d9

Browse files
authored
Merge pull request #134 from contentstack/feat/DX-1449
feat: added addParams support for entry class
2 parents 2d2911b + 26c0510 commit de0c2d9

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/lib/entry.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ export class Entry {
1010
private _urlPath: string;
1111
protected _variants: string;
1212
_queryParams: { [key: string]: string | number | string[] } = {};
13-
1413
constructor(client: AxiosInstance, contentTypeUid: string, entryUid: string) {
1514
this._client = client;
1615
this._contentTypeUid = contentTypeUid;
@@ -195,4 +194,22 @@ export class Entry {
195194

196195
return response;
197196
}
197+
198+
/**
199+
* @method addParams
200+
* @memberof Entry
201+
* @description Adds a query parameter to the query.
202+
* @example
203+
* import contentstack from '@contentstack/delivery-sdk'
204+
*
205+
* const stack = contentstack.stack({ apiKey: "apiKey", deliveryToken: "deliveryToken", environment: "environment" });
206+
* const result = stack.contentType("contentTypeUid").entry().addParams({"key": "value"}).fetch()
207+
*
208+
* @returns {Entry}
209+
*/
210+
addParams(paramObj: { [key: string]: string | number | string[] }): Entry {
211+
this._queryParams = { ...this._queryParams, ...paramObj };
212+
213+
return this;
214+
}
198215
}

0 commit comments

Comments
 (0)