()
| 22 | } |
| 23 | |
| 24 | func getCmd() *cobra.Command { |
| 25 | cmd := &cobra.Command{ |
| 26 | Use: "get-channel-type [channel-type] --output-format [json|tree]", |
| 27 | Short: "Get channel type", |
| 28 | Example: heredoc.Doc(` |
| 29 | # Returns a channel type and prints it as JSON |
| 30 | $ stream-cli chat get-channel-type livestream |
| 31 | |
| 32 | # Returns a channel type and prints it as a browsable tree |
| 33 | $ stream-cli chat get-channel-type messaging --output-format tree |
| 34 | `), |
| 35 | Args: cobra.ExactArgs(1), |
| 36 | RunE: func(cmd *cobra.Command, args []string) error { |
| 37 | c, err := config.GetConfig(cmd).GetClient(cmd) |
| 38 | if err != nil { |
| 39 | return err |
| 40 | } |
| 41 | |
| 42 | ct := args[0] |
| 43 | |
| 44 | resp, err := c.GetChannelType(cmd.Context(), ct) |
| 45 | if err != nil { |
| 46 | return err |
| 47 | } |
| 48 | |
| 49 | return utils.PrintObject(cmd, resp) |
| 50 | }, |
| 51 | } |
| 52 | |
| 53 | fl := cmd.Flags() |
| 54 | fl.StringP("output-format", "o", "json", "[optional] Output format. Can be json or tree") |
| 55 | |
| 56 | return cmd |
| 57 | } |
| 58 | |
| 59 | func createCmd() *cobra.Command { |
| 60 | cmd := &cobra.Command{ |
no test coverage detected