1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
16
17 package importer
18
19 import (
20 "errors"
21 "fmt"
22 "net/http"
23 )
24
25 type todoImp struct {
26 OAuth1
27 Props Properties
28 }
29
30 func (t *todoImp) Properties() Properties {
31 return t.Props
32 }
33
34 func (*todoImp) Run(*RunContext) error {
35 return errors.New("fake error from todo importer")
36 }
37
38 func (*todoImp) IsAccountReady(acctNode *Object) (ok bool, err error) {
39 return
40 }
41
42 func (*todoImp) SummarizeAccount(acctNode *Object) string { return "" }
43
44 func (*todoImp) ServeSetup(w http.ResponseWriter, r *http.Request, ctx *SetupContext) error {
45 w.Header().Set("Content-Type", "text/plain; charset=utf-8")
46 fmt.Fprintf(w, "The Setup page for the TODO importer.\nnode = %v\ncallback = %s\naccount URL = %s\n",
47 ctx.AccountNode,
48 ctx.CallbackURL(),
49 "ctx.AccountURL()")
50 return nil
51 }
52
53 func (*todoImp) ServeCallback(w http.ResponseWriter, r *http.Request, ctx *SetupContext) {
54 w.Header().Set("Content-Type", "text/plain; charset=utf-8")
55 fmt.Fprintf(w, "The callback page for the TODO importer.\n")
56 }