add rm command for models (#151)

This commit is contained in:
Patrick Devine
2023-07-20 16:09:23 -07:00
committed by GitHub
parent 8454f298ac
commit e7a393de54
5 changed files with 166 additions and 25 deletions

View File

@@ -210,3 +210,16 @@ func (c *Client) List(ctx context.Context) (*ListResponse, error) {
}
return &lr, nil
}
type DeleteProgressFunc func(ProgressResponse) error
func (c *Client) Delete(ctx context.Context, req *DeleteRequest, fn DeleteProgressFunc) error {
return c.stream(ctx, http.MethodDelete, "/api/delete", req, func(bts []byte) error {
var resp ProgressResponse
if err := json.Unmarshal(bts, &resp); err != nil {
return err
}
return fn(resp)
})
}