()
| 18 | } |
| 19 | |
| 20 | func getCmd() *cobra.Command { |
| 21 | cmd := &cobra.Command{ |
| 22 | Use: "get-reactions [message-id]", |
| 23 | Short: "Get reactions for a message", |
| 24 | Example: heredoc.Doc(` |
| 25 | # Get reactions for a [08f64828-3bba-42bd-8430-c26a3634ee5c] message |
| 26 | $ stream-cli chat get-reactions 08f64828-3bba-42bd-8430-c26a3634ee5c --output-format json |
| 27 | `), |
| 28 | Args: cobra.ExactArgs(1), |
| 29 | RunE: func(cmd *cobra.Command, args []string) error { |
| 30 | c, err := config.GetConfig(cmd).GetClient(cmd) |
| 31 | if err != nil { |
| 32 | return err |
| 33 | } |
| 34 | |
| 35 | msgID := args[0] |
| 36 | |
| 37 | resp, err := c.GetReactions(cmd.Context(), msgID, nil) |
| 38 | if err != nil { |
| 39 | return err |
| 40 | } |
| 41 | |
| 42 | return utils.PrintObject(cmd, resp.Reactions) |
| 43 | }, |
| 44 | } |
| 45 | |
| 46 | fl := cmd.Flags() |
| 47 | fl.StringP("output-format", "o", "json", "[optional] Output format. Can be json or tree") |
| 48 | |
| 49 | return cmd |
| 50 | } |
| 51 | |
| 52 | func sendCmd() *cobra.Command { |
| 53 | cmd := &cobra.Command{ |
no test coverage detected