Config for todo

This commit is contained in:
bel
2020-04-02 23:12:32 +00:00
parent eead63ecb6
commit dac2114af0
3 changed files with 110 additions and 3 deletions

31
upload.go Normal file
View File

@@ -0,0 +1,31 @@
package main
import (
"errors"
"local/oauth2"
"log"
"net/http"
"net/url"
"strings"
"time"
)
func Upload(config Config, transaction *Transaction) error {
params := url.Values{
"list": {"2548023766"},
"title": {"test task: " + time.Now().String()},
"tag": {"expense"},
}
req, err := http.NewRequest("POST", config.TodoAddr+"/ajax.php?newTask", strings.NewReader(params.Encode()))
if err != nil {
return err
}
req.Header.Set("Cookie", oauth2.COOKIE+"="+config.TodoToken)
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
resp, err := http.DefaultClient.Do(req)
if err != nil {
return err
}
log.Printf("%+v\n\n%+v", req, resp)
return errors.New("not impl")
}