working but should scroll emails
This commit is contained in:
19
upload.go
19
upload.go
@@ -1,20 +1,19 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"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"},
|
||||
"list": {config.TodoList},
|
||||
"title": {fmt.Sprintf("%v: %s @ %s @ %s", transaction.Bank, transaction.Amount, transaction.Account, transaction.Date)},
|
||||
"tag": {config.TodoTag},
|
||||
}
|
||||
req, err := http.NewRequest("POST", config.TodoAddr+"/ajax.php?newTask", strings.NewReader(params.Encode()))
|
||||
if err != nil {
|
||||
@@ -26,6 +25,10 @@ func Upload(config Config, transaction *Transaction) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
log.Printf("%+v\n\n%+v", req, resp)
|
||||
return errors.New("not impl")
|
||||
defer resp.Body.Close()
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
b, _ := ioutil.ReadAll(resp.Body)
|
||||
return fmt.Errorf("bad status from todo: %v: %s", resp.StatusCode, b)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user