mirror of
https://codeberg.org/scip/ephemerup.git
synced 2025-12-17 04:30:57 +01:00
added modify command for upload and form
This commit is contained in:
@@ -357,6 +357,43 @@ func Download(w io.Writer, c *cfg.Config, args []string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func Modify(w io.Writer, c *cfg.Config, args []string, typ int) error {
|
||||
id := args[0]
|
||||
var rq *Request
|
||||
|
||||
// setup url, req.Request, timeout handling etc
|
||||
switch typ {
|
||||
case common.TypeUpload:
|
||||
rq = Setup(c, "/uploads/"+id)
|
||||
rq.R.
|
||||
SetBody(&common.Upload{
|
||||
Expire: c.Expire,
|
||||
Description: c.Description,
|
||||
})
|
||||
case common.TypeForm:
|
||||
rq = Setup(c, "/forms/"+id)
|
||||
rq.R.
|
||||
SetBody(&common.Form{
|
||||
Expire: c.Expire,
|
||||
Description: c.Description,
|
||||
Notify: c.Notify,
|
||||
})
|
||||
}
|
||||
|
||||
// actual put w/ settings
|
||||
resp, err := rq.R.Put(rq.Url)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := HandleResponse(c, resp); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return RespondExtended(w, resp)
|
||||
}
|
||||
|
||||
/**** Forms stuff ****/
|
||||
func CreateForm(w io.Writer, c *cfg.Config) error {
|
||||
// setup url, req.Request, timeout handling etc
|
||||
|
||||
Reference in New Issue
Block a user