This repository was archived by the owner on Sep 1, 2022. It is now read-only.
File tree 2 files changed +31
-0
lines changed
2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ test('Create an instance', t => {
31
31
'getProviderAuthenticationUrl' ,
32
32
'authenticateProvider' ,
33
33
'getEntries' ,
34
+ 'getEntryCount' ,
34
35
'getEntry' ,
35
36
'createEntry' ,
36
37
'updateEntry' ,
@@ -349,6 +350,22 @@ test('Get entries', async t => {
349
350
) ;
350
351
} ) ;
351
352
353
+ test ( 'Get entry count' , async t => {
354
+ await t . context . strapi . getEntryCount ( 'user' , {
355
+ name_contains : 'jack'
356
+ } ) ;
357
+
358
+ t . true (
359
+ t . context . axiosRequest . calledWithExactly ( {
360
+ method : 'get' ,
361
+ params : {
362
+ name_contains : 'jack'
363
+ } ,
364
+ url : '/user/count'
365
+ } )
366
+ ) ;
367
+ } ) ;
368
+
352
369
test ( 'Get entry' , async t => {
353
370
await t . context . strapi . getEntry ( 'user' , 'ID' ) ;
354
371
Original file line number Diff line number Diff line change @@ -241,6 +241,20 @@ export default class Strapi {
241
241
} ) ;
242
242
}
243
243
244
+ /**
245
+ * Get the total count of entries with the provided criteria
246
+ * @param contentType
247
+ * @param params Filter and order queries.
248
+ */
249
+ public getEntryCount (
250
+ contentType : string ,
251
+ params ?: AxiosRequestConfig [ 'params' ]
252
+ ) : Promise < object [ ] > {
253
+ return this . request ( 'get' , `/${ contentType } /count` , {
254
+ params
255
+ } ) ;
256
+ }
257
+
244
258
/**
245
259
* Get a specific entry
246
260
* @param contentType Type of entry
You can’t perform that action at this time.
0 commit comments