@@ -300,7 +300,31 @@ class CblReactnativeModule(reactContext: ReactApplicationContext) :
300300 }
301301 }
302302
303-
303+ @ReactMethod
304+ fun collection_GetDocumentExpiration (
305+ docId : String ,
306+ name : String ,
307+ scopeName : String ,
308+ collectionName : String ,
309+ promise : Promise
310+ ){
311+ try {
312+ if (! DataValidation .validateCollection(collectionName, scopeName, name, promise) ||
313+ ! DataValidation .validateDocumentId(docId, promise)) {
314+ return
315+ }
316+ val map = Arguments .createMap()
317+ val expiration = CollectionManager .getDocumentExpiration(docId, collectionName, scopeName, name)
318+ if (expiration == null ) {
319+ map.putNull(" expiration" )
320+ } else {
321+ map.putString(" expiration" , DataAdapter .dateToISOString(expiration))
322+ }
323+ promise.resolve(map)
324+ } catch (e: Exception ) {
325+ promise.reject(" DOCUMENT_ERROR" , e.message)
326+ }
327+ }
304328
305329 @ReactMethod
306330 fun collection_GetIndexes (
@@ -328,6 +352,47 @@ class CblReactnativeModule(reactContext: ReactApplicationContext) :
328352 }
329353 }
330354
355+ @ReactMethod
356+ fun collection_PurgeDocument (
357+ docId : String ,
358+ name : String ,
359+ scopeName : String ,
360+ collectionName : String ,
361+ promise : Promise
362+ ) {
363+ try {
364+ if (! DataValidation .validateCollection(collectionName, scopeName, name, promise) ||
365+ ! DataValidation .validateDocumentId(docId, promise)) {
366+ return
367+ }
368+ CollectionManager .purgeDocument(docId, collectionName, scopeName, name)
369+ promise.resolve(null )
370+ } catch (e: Exception ) {
371+ promise.reject(" DOCUMENT_ERROR" , e.message)
372+ }
373+ }
374+
375+ @ReactMethod
376+ fun collection_SetDocumentExpiration (
377+ expiration : String ,
378+ docId : String ,
379+ name : String ,
380+ scopeName : String ,
381+ collectionName : String ,
382+ promise : Promise ){
383+ try {
384+ if (! DataValidation .validateCollection(collectionName, scopeName, name, promise) ||
385+ ! DataValidation .validateDocumentId(docId, promise)
386+ ) {
387+ return
388+ }
389+ CollectionManager .setDocumentExpiration(expiration, docId, collectionName, scopeName, name)
390+ promise.resolve(null )
391+ } catch (e: Exception ) {
392+ promise.reject(" DOCUMENT_ERROR" , e.message)
393+ }
394+ }
395+
331396 // Database Functions
332397 @ReactMethod
333398 fun database_ChangeEncryptionKey (
0 commit comments