@@ -174,7 +174,7 @@ export class Query extends BaseQuery {
174
174
*
175
175
* const stack = contentstack.Stack({ apiKey: "apiKey", deliveryToken: "deliveryToken", environment: "environment" });
176
176
* const query = stack.contentType("contentTypeUid").entry().query();
177
- * const result = containedIn('fieldUid', ['value1', 'value2']).find()
177
+ * const result = await query. containedIn('fieldUid', ['value1', 'value2']).find()
178
178
*
179
179
* @returns {Query }
180
180
*/
@@ -192,7 +192,7 @@ export class Query extends BaseQuery {
192
192
*
193
193
* const stack = contentstack.Stack({ apiKey: "apiKey", deliveryToken: "deliveryToken", environment: "environment" });
194
194
* const query = stack.contentType("contentTypeUid").entry().query();
195
- * const result = notContainedIn('fieldUid', ['value1', 'value2']).find()
195
+ * const result = await query. notContainedIn('fieldUid', ['value1', 'value2']).find()
196
196
*
197
197
* @returns {Query }
198
198
*/
@@ -210,7 +210,7 @@ export class Query extends BaseQuery {
210
210
*
211
211
* const stack = contentstack.Stack({ apiKey: "apiKey", deliveryToken: "deliveryToken", environment: "environment" });
212
212
* const query = stack.contentType("contentTypeUid").entry().query();
213
- * const result = notExists('fieldUid').find()
213
+ * const result = await query. notExists('fieldUid').find()
214
214
*
215
215
* @returns {Query }
216
216
*/
@@ -227,9 +227,9 @@ export class Query extends BaseQuery {
227
227
* import contentstack from '@contentstack/delivery-sdk'
228
228
*
229
229
* const stack = contentstack.Stack({ apiKey: "apiKey", deliveryToken: "deliveryToken", environment: "environment" });
230
- * const query1 = await contentType.Entry().query().containedIn('fieldUID', ['value']);
231
- * const query2 = await contentType.Entry().query().where('fieldUID', QueryOperation.EQUALS, 'value2');
232
- * const query = await contentType.Entry().query().or(query1, query2).find();
230
+ * const query1 = stack. contentType('contenttype_uid') .Entry().query().containedIn('fieldUID', ['value']);
231
+ * const query2 = stack. contentType('contenttype_uid') .Entry().query().where('fieldUID', QueryOperation.EQUALS, 'value2');
232
+ * const query = await stack. contentType('contenttype_uid') .Entry().query().or(query1, query2).find();
233
233
*
234
234
* @returns {Query }
235
235
*/
@@ -250,9 +250,9 @@ export class Query extends BaseQuery {
250
250
* import contentstack from '@contentstack/delivery-sdk'
251
251
*
252
252
* const stack = contentstack.Stack({ apiKey: "apiKey", deliveryToken: "deliveryToken", environment: "environment" });
253
- * const query1 = await contentType.Entry().query().containedIn('fieldUID', ['value']);
254
- * const query2 = await contentType.Entry().query().where('fieldUID', QueryOperation.EQUALS, 'value2');
255
- * const query = await contentType.Entry().query().and(query1, query2).find();
253
+ * const query1 = stack. contentType('contenttype_uid') .Entry().query().containedIn('fieldUID', ['value']);
254
+ * const query2 = stack. contentType('contenttype_uid') .Entry().query().where('fieldUID', QueryOperation.EQUALS, 'value2');
255
+ * const query = await stack. contentType('contenttype_uid') .Entry().query().and(query1, query2).find();
256
256
*
257
257
* @returns {Query }
258
258
*/
@@ -264,4 +264,39 @@ export class Query extends BaseQuery {
264
264
this . _parameters . $and = paramsList ;
265
265
return this ;
266
266
}
267
+
268
+ /**
269
+ * @method equalTo
270
+ * @memberof Query
271
+ * @description Returns the raw (JSON) query based on the filters applied on Query object.
272
+ * @example
273
+ * import contentstack from '@contentstack/delivery-sdk'
274
+ *
275
+ * const stack = contentstack.Stack({ apiKey: "apiKey", deliveryToken: "deliveryToken", environment: "environment" });
276
+ * const query = await stack.contentType('contenttype_uid').Entry().query().equalTo('fieldUid', 'value').find();
277
+ *
278
+ * @returns {Query }
279
+ */
280
+ equalTo ( key : string , value : string | number | boolean ) : Query {
281
+ this . _parameters [ key ] = value ;
282
+ return this ;
283
+ }
284
+
285
+ /**
286
+ * @method equalTo
287
+ * @memberof Query
288
+ * @description Returns the raw (JSON) query based on the filters applied on Query object.
289
+ * @example
290
+ * import contentstack from '@contentstack/delivery-sdk'
291
+ *
292
+ * const stack = contentstack.Stack({ apiKey: "apiKey", deliveryToken: "deliveryToken", environment: "environment" });
293
+ * const query = stack.contentType('contenttype_uid').query().where('title', QueryOperation.EQUALS, 'value');
294
+ * const entryQuery = await stack.contentType('contenttype_uid').query().referenceIn('reference_uid', query).find<TEntry>();
295
+ *
296
+ * @returns {Query }
297
+ */
298
+ referenceIn ( key : string , query : Query ) {
299
+ this . _parameters [ key ] = { '$in_query' : query . _parameters }
300
+ return this ;
301
+ }
267
302
}
0 commit comments