MCPcopy Create free account
hub / github.com/GetStream/stream-cli / deleteCmd

Function deleteCmd

pkg/cmd/chat/reaction/reaction.go:98–135  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

96}
97
98func deleteCmd() *cobra.Command {
99 cmd := &cobra.Command{
100 Use: "delete-reaction --message-id [message-id] --reaction-type [reaction-type] --user-id [user-id]",
101 Short: "Delete a reaction from a message",
102 Example: heredoc.Doc(`
103 # Delete a reaction from [08f64828-3bba-42bd-8430-c26a3634ee5c] message
104 $ stream-cli chat delete-reaction --message-id 08f64828-3bba-42bd-8430-c26a3634ee5c --reaction-type like --user-id 12345
105 `),
106 RunE: func(cmd *cobra.Command, args []string) error {
107 c, err := config.GetConfig(cmd).GetClient(cmd)
108 if err != nil {
109 return err
110 }
111
112 reactionType, _ := cmd.Flags().GetString("reaction-type")
113 userID, _ := cmd.Flags().GetString("user-id")
114 msgID, _ := cmd.Flags().GetString("message-id")
115
116 _, err = c.Channel("", "").DeleteReaction(cmd.Context(), msgID, reactionType, userID)
117 if err != nil {
118 return err
119 }
120
121 cmd.Println("Successfully deleted reaction")
122 return nil
123 },
124 }
125
126 fl := cmd.Flags()
127 fl.StringP("reaction-type", "r", "", "[required] The reaction type to delete")
128 fl.StringP("message-id", "m", "", "[required] The message id to delete the reaction from")
129 fl.StringP("user-id", "u", "", "[required] The user id of the user deleting the reaction")
130 _ = cmd.MarkFlagRequired("reaction-type")
131 _ = cmd.MarkFlagRequired("message-id")
132 _ = cmd.MarkFlagRequired("user-id")
133
134 return cmd
135}

Callers 1

NewCmdsFunction · 0.70

Calls 2

GetConfigFunction · 0.92
GetClientMethod · 0.80

Tested by

no test coverage detected