Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion src/lib/entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export class Entry {
private _urlPath: string;
protected _variants: string;
_queryParams: { [key: string]: string | number | string[] } = {};

constructor(client: AxiosInstance, contentTypeUid: string, entryUid: string) {
this._client = client;
this._contentTypeUid = contentTypeUid;
Expand Down Expand Up @@ -195,4 +194,22 @@ export class Entry {

return response;
}

/**
* @method addParams
* @memberof Entry
* @description Adds a query parameter to the query.
* @example
* import contentstack from '@contentstack/delivery-sdk'
*
* const stack = contentstack.stack({ apiKey: "apiKey", deliveryToken: "deliveryToken", environment: "environment" });
* const result = stack.contentType("contentTypeUid").entry().addParams({"key": "value"}).fetch()
*
* @returns {Entry}
*/
addParams(paramObj: { [key: string]: string | number | string[] }): Entry {
this._queryParams = { ...this._queryParams, ...paramObj };

return this;
}
}