77 "path/filepath"
88 "time"
99
10- stream "github.com/GetStream/stream-chat-go/v5 "
10+ stream "github.com/GetStream/stream-chat-go/v8 "
1111 "github.com/MakeNowJust/heredoc"
1212 "github.com/spf13/cobra"
1313
@@ -76,6 +76,12 @@ func uploadCmd() *cobra.Command {
7676 mode = stream .InsertMode
7777 }
7878
79+ var opts []stream.CreateImportOption
80+ if cmd .Flags ().Changed ("merge-custom" ) {
81+ mergeCustom , _ := cmd .Flags ().GetBool ("merge-custom" )
82+ opts = append (opts , stream .WithMergeCustom (mergeCustom ))
83+ }
84+
7985 createImportURLResp , err := c .CreateImportURL (cmd .Context (), filepath .Base (filename ))
8086 if err != nil {
8187 return err
@@ -84,7 +90,7 @@ func uploadCmd() *cobra.Command {
8490 if err := uploadToS3 (cmd .Context (), filename , createImportURLResp .UploadURL ); err != nil {
8591 return err
8692 }
87- createImportResp , err := c .CreateImport (cmd .Context (), createImportURLResp .Path , mode )
93+ createImportResp , err := c .CreateImport (cmd .Context (), createImportURLResp .Path , mode , opts ... )
8894 if err != nil {
8995 return err
9096 }
@@ -94,7 +100,8 @@ func uploadCmd() *cobra.Command {
94100 }
95101
96102 fl := cmd .Flags ()
97- fl .StringP ("mode" , "m" , "upsert" , "[optional] Import mode. Canbe upsert or insert" )
103+ fl .StringP ("mode" , "m" , "upsert" , "[optional] Import mode. Can be upsert or insert" )
104+ fl .Bool ("merge-custom" , false , "[optional] Merge custom data during import" )
98105 fl .StringP ("output-format" , "o" , "json" , "[optional] Output format. Can be json or tree" )
99106 fl .Bool ("lighter-validation-id" , false , "[optional] allows to pass ! in channel ID" )
100107
0 commit comments