Home Download Docs Code Community
     1	/*
     2	Copyright 2014 The Perkeep Authors
     3	
     4	Licensed under the Apache License, Version 2.0 (the "License");
     5	you may not use this file except in compliance with the License.
     6	You may obtain a copy of the License at
     7	
     8	     http://www.apache.org/licenses/LICENSE-2.0
     9	
    10	Unless required by applicable law or agreed to in writing, software
    11	distributed under the License is distributed on an "AS IS" BASIS,
    12	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13	See the License for the specific language governing permissions and
    14	limitations under the License.
    15	*/
    16	
    17	package importer
    18	
    19	import (
    20		"errors"
    21		"fmt"
    22		"net/http"
    23	)
    24	
    25	type todoImp struct {
    26		OAuth1 // for CallbackRequestAccount and CallbackURLParameters
    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	}
Website layout inspired by memcached.
Content by the authors.