File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed
Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -643,6 +643,16 @@ def get_export_channel_status(task_id)
643643 get ( "export_channels/#{ task_id } " )
644644 end
645645
646+ # Requests a users export.
647+ #
648+ # User exports are created asynchronously, you can use the Task ID returned by
649+ # the APIs to keep track of the status and to download the final result when it is ready.
650+ # Use `get_task` to check the status of the export.
651+ sig { params ( user_ids : T ::Array [ String ] ) . returns ( StreamChat ::StreamResponse ) }
652+ def export_users ( user_ids )
653+ post ( 'export/users' , data : { user_ids : user_ids } )
654+ end
655+
646656 # Returns the status of a task.
647657 sig { params ( task_id : String ) . returns ( StreamChat ::StreamResponse ) }
648658 def get_task ( task_id )
Original file line number Diff line number Diff line change @@ -592,6 +592,29 @@ def loop_times(times)
592592 end
593593 end
594594
595+ it 'request users export' do
596+ user_id1 = SecureRandom . uuid
597+ @client . update_users ( [ { id : user_id1 } ] )
598+
599+ resp = @client . export_users ( [ user_id1 ] )
600+ expect ( resp [ 'task_id' ] ) . not_to be_empty
601+
602+ task_id = resp [ 'task_id' ]
603+ loop do
604+ resp = @client . get_task ( task_id )
605+ expect ( resp [ 'status' ] ) . not_to be_empty
606+ expect ( resp [ 'created_at' ] ) . not_to be_empty
607+ expect ( resp [ 'updated_at' ] ) . not_to be_empty
608+ if resp [ 'status' ] == 'completed'
609+ expect ( resp [ 'result' ] ) . not_to be_empty
610+ expect ( resp [ 'result' ] [ 'url' ] ) . not_to be_empty
611+ expect ( resp ) . not_to include 'error'
612+ break
613+ end
614+ sleep ( 0.5 )
615+ end
616+ end
617+
595618 it 'request delete channels' do
596619 ch1 = @client . channel ( 'messaging' , channel_id : SecureRandom . uuid )
597620 ch1 . create ( @random_user [ :id ] )
You can’t perform that action at this time.
0 commit comments