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

Function deleteImageCmd

pkg/cmd/chat/file/file.go:156–189  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

154}
155
156func deleteImageCmd() *cobra.Command {
157 cmd := &cobra.Command{
158 Use: "delete-image --channel-type [channel-type] --channel-id [channel-id] --image-url [image-url]",
159 Short: "Delete an image",
160 RunE: func(cmd *cobra.Command, args []string) error {
161 c, err := config.GetConfig(cmd).GetClient(cmd)
162 if err != nil {
163 return err
164 }
165
166 chType, _ := cmd.Flags().GetString("channel-type")
167 chID, _ := cmd.Flags().GetString("channel-id")
168 imageURL, _ := cmd.Flags().GetString("image-url")
169
170 _, err = c.Channel(chType, chID).DeleteImage(cmd.Context(), imageURL)
171 if err != nil {
172 return err
173 }
174
175 cmd.Println("Successfully deleted image")
176 return nil
177 },
178 }
179
180 fl := cmd.Flags()
181 fl.StringP("channel-type", "t", "", "[required] Channel type to interact with")
182 fl.StringP("channel-id", "i", "", "[required] Channel id to interact with")
183 fl.StringP("image-url", "u", "", "[required] URL of the image to delete")
184 _ = cmd.MarkFlagRequired("channel-type")
185 _ = cmd.MarkFlagRequired("channel-id")
186 _ = cmd.MarkFlagRequired("image-url")
187
188 return cmd
189}

Callers 1

NewCmdsFunction · 0.85

Calls 2

GetConfigFunction · 0.92
GetClientMethod · 0.80

Tested by

no test coverage detected