Added mail notification support

This commit is contained in:
2023-03-28 15:47:54 +02:00
parent fb536c2bcb
commit 737df3c802
11 changed files with 150 additions and 29 deletions

View File

@@ -50,7 +50,7 @@ type ListParams struct {
Apicontext string `json:"apicontext"`
}
const Maxwidth = 10
const Maxwidth = 12
/*
Create a new request object for outgoing queries
@@ -142,15 +142,15 @@ func HandleResponse(c *cfg.Config, resp *req.Response) error {
fmt.Println(trace)
}
if !resp.IsSuccessState() {
return fmt.Errorf("bad response: %s", resp.Status)
}
if err := json.Unmarshal([]byte(resp.String()), &r); err != nil {
// text output!
r.Message = resp.String()
}
if !resp.IsSuccessState() {
return fmt.Errorf("bad response: %s (%s)", resp.Status, r.Message)
}
if !r.Success {
if len(r.Message) == 0 {
if resp.Err != nil {
@@ -331,6 +331,7 @@ func CreateForm(w io.Writer, c *cfg.Config) error {
SetFormData(map[string]string{
"expire": c.Expire,
"description": c.Description,
"notify": c.Notify,
}).
Post(rq.Url)

View File

@@ -95,6 +95,7 @@ func WriteExtended(w io.Writer, response *common.Response) {
fmt.Fprintf(w, format, "Context", entry.Context)
fmt.Fprintf(w, format, "Created", entry.Created)
fmt.Fprintf(w, format, "Description", entry.Description)
fmt.Fprintf(w, format, "Notify", entry.Notify)
fmt.Fprintf(w, format, "Url", entry.Url)
fmt.Fprintln(w)
}