func Add(c appengine.Context, task *Task, queueName string) (*Task, error) {
	if queueName == "" {
		queueName = "default"
	}
	req := &taskqueue_proto.TaskQueueAddRequest{
		QueueName: []byte(queueName),
		TaskName:  []byte(task.Name),
		EtaUsec:   proto.Int64(time.Nanoseconds()/1e3 + task.Delay),
	}
	method := task.Method
	if method == "" {
		method = "POST"
	}
	if method == "PULL" {
		req.Body = task.Payload
		req.Mode = taskqueue_proto.NewTaskQueueMode_Mode(taskqueue_proto.TaskQueueMode_PULL)
	} else {
		if v, ok := taskqueue_proto.TaskQueueAddRequest_RequestMethod_value[method]; ok {
			req.Method = taskqueue_proto.NewTaskQueueAddRequest_RequestMethod(
				taskqueue_proto.TaskQueueAddRequest_RequestMethod(v))
		} else {
			return nil, fmt.Errorf("taskqueue: bad method %q", method)
		}
		req.Url = []byte(task.Path)
		for k, vs := range task.Header {
			for _, v := range vs {
				req.Header = append(req.Header, &taskqueue_proto.TaskQueueAddRequest_Header{
					Key:   []byte(k),
					Value: []byte(v),
				})
			}
		}
		if method == "POST" || method == "PUT" {
			req.Body = task.Payload
		}
	}
	res := &taskqueue_proto.TaskQueueAddResponse{}
	if err := c.Call("taskqueue", "Add", req, res, nil); err != nil {
		return nil, err
	}
	resultTask := *task
	resultTask.Method = method
	if task.Name == "" {
		resultTask.Name = string(res.ChosenTaskName)
	}
	return &resultTask, nil
}
Add adds the task to a named queue.
An empty queue name means that the default queue will be used.
Add returns an equivalent Task with defaults filled in, including setting
the task's Name field to the chosen name if the original was empty.
package taskqueue
import (
	"fmt"
	"http"
	"time"
	"url"
	"appengine"
	"appengine_internal"
	"goprotobuf.googlecode.com/hg/proto"
	taskqueue_proto "appengine_internal/taskqueue"
)
type Task struct {
	Path string
	Payload []byte
	Header http.Header
	Method string
	Name string
	Delay int64
}
func NewPOSTTask(path string, params url.Values) *Task {
	h := make(http.Header)
	h.Set("Content-Type", "application/x-www-form-urlencoded")
	return &Task{
		Path:    path,
		Payload: []byte(params.Encode()),
		Header:  h,
		Method:  "POST",
	}
}