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

Function deleteFileCmd

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

Source from the content-addressed store, hash-verified

119}
120
121func deleteFileCmd() *cobra.Command {
122 cmd := &cobra.Command{
123 Use: "delete-file --channel-type [channel-type] --channel-id [channel-id] --file-url [file-url]",
124 Short: "Delete a file",
125 RunE: func(cmd *cobra.Command, args []string) error {
126 c, err := config.GetConfig(cmd).GetClient(cmd)
127 if err != nil {
128 return err
129 }
130
131 chType, _ := cmd.Flags().GetString("channel-type")
132 chID, _ := cmd.Flags().GetString("channel-id")
133 fileUrl, _ := cmd.Flags().GetString("file-url")
134
135 _, err = c.Channel(chType, chID).DeleteFile(cmd.Context(), fileUrl)
136 if err != nil {
137 return err
138 }
139
140 cmd.Println("Successfully deleted file")
141 return nil
142 },
143 }
144
145 fl := cmd.Flags()
146 fl.StringP("channel-type", "t", "", "[required] Channel type to interact with")
147 fl.StringP("channel-id", "i", "", "[required] Channel id to interact with")
148 fl.StringP("file-url", "u", "", "[required] URL of the file to delete")
149 _ = cmd.MarkFlagRequired("channel-type")
150 _ = cmd.MarkFlagRequired("channel-id")
151 _ = cmd.MarkFlagRequired("file-url")
152
153 return cmd
154}
155
156func deleteImageCmd() *cobra.Command {
157 cmd := &cobra.Command{

Callers 1

NewCmdsFunction · 0.85

Calls 2

GetConfigFunction · 0.92
GetClientMethod · 0.80

Tested by

no test coverage detected