func (dr DeleteResult) Extract() (DeleteHeader, error) {
	var dh DeleteHeader
	if dr.Err != nil {
		return dh, dr.Err
	}
	if err := gophercloud.DecodeHeader(dr.Header, &dh); err != nil {
		return dh, err
	}
	if date, ok := dr.Header["Date"]; ok && len(date) > 0 {
		t, err := time.Parse(time.RFC1123, dr.Header["Date"][0])
		if err != nil {
			return dh, err
		}
		dh.Date = t
	}
	return dh, nil
}
Extract will return a struct of headers returned from a call to Delete. To obtain
a map of headers, call the ExtractHeader method on the DeleteResult.
package objects
import (
	"fmt"
	"io"
	"io/ioutil"
	"strconv"
	"strings"
	"time"
	"github.com/rackspace/gophercloud"
	"github.com/rackspace/gophercloud/pagination"
	"github.com/mitchellh/mapstructure"
)
type Object struct {
	Bytes int64 `json:"bytes" mapstructure:"bytes"`
	ContentType string `json:"content_type" mapstructure:"content_type"`
	Hash string `json:"hash" mapstructure:"hash"`
	LastModified string `json:"last_modified" mapstructure:"last_modified"`
	Name string `json:"name" mapstructure:"name"`
}
type ObjectPage struct {
	pagination.MarkerPageBase
}
func (r ObjectPage) IsEmpty() (bool, error) {
	names, err := ExtractNames(r)
	if err != nil {
		return true, err
	}
	return len(names) == 0, nil
}
func (r ObjectPage) LastMarker() (string, error) {
	names, err := ExtractNames(r)
	if err != nil {
		return "", err
	}
	if len(names) == 0 {
		return "", nil
	}
	return names[len(names)-1], nil
}
func ExtractInfo(page pagination.Page) ([]Object, error) {
	untyped := page.(ObjectPage).Body.([]interface{})
	results := make([]Object, len(untyped))
	for index, each := range untyped {
		object := each.(map[string]interface{})
		err := mapstructure.Decode(object, &results[index])
		if err != nil {
			return results, err
		}
	}
	return results, nil
}
func ExtractNames(page pagination.Page) ([]string, error) {
	casted := page.(ObjectPage)
	ct := casted.Header.Get("Content-Type")
	switch {
	case strings.HasPrefix(ct, "application/json"):
		parsed, err := ExtractInfo(page)
		if err != nil {
			return nil, err
		}
		names := make([]string, 0, len(parsed))
		for _, object := range parsed {
			names = append(names, object.Name)
		}
		return names, nil
	case strings.HasPrefix(ct, "text/plain"):
		names := make([]string, 0, 50)
		body := string(page.(ObjectPage).Body.([]uint8))
		for _, name := range strings.Split(body, "\n") {
			if len(name) > 0 {
				names = append(names, name)
			}
		}
		return names, nil
	case strings.HasPrefix(ct, "text/html"):
		return []string{}, nil
	default:
		return nil, fmt.Errorf("Cannot extract names from response with content-type: [%s]", ct)
	}
}
type DownloadHeader struct {
	AcceptRanges       string    `mapstructure:"Accept-Ranges"`
	ContentDisposition string    `mapstructure:"Content-Disposition"`
	ContentEncoding    string    `mapstructure:"Content-Encoding"`
	ContentLength      int64     `mapstructure:"Content-Length"`
	ContentType        string    `mapstructure:"Content-Type"`
	Date               time.Time `mapstructure:"-"`
	DeleteAt           time.Time `mapstructure:"-"`
	ETag               string    `mapstructure:"Etag"`
	LastModified       time.Time `mapstructure:"-"`
	ObjectManifest     string    `mapstructure:"X-Object-Manifest"`
	StaticLargeObject  bool      `mapstructure:"X-Static-Large-Object"`
	TransID            string    `mapstructure:"X-Trans-Id"`
}
type DownloadResult struct {
	gophercloud.HeaderResult
	Body io.ReadCloser
}
func (dr DownloadResult) Extract() (DownloadHeader, error) {
	var dh DownloadHeader
	if dr.Err != nil {
		return dh, dr.Err
	}
	if err := gophercloud.DecodeHeader(dr.Header, &dh); err != nil {
		return dh, err
	}
	if date, ok := dr.Header["Date"]; ok && len(date) > 0 {
		t, err := time.Parse(time.RFC1123, date[0])
		if err != nil {
			return dh, err
		}
		dh.Date = t
	}
	if date, ok := dr.Header["Last-Modified"]; ok && len(date) > 0 {
		t, err := time.Parse(time.RFC1123, date[0])
		if err != nil {
			return dh, err
		}
		dh.LastModified = t
	}
	if date, ok := dr.Header["X-Delete-At"]; ok && len(date) > 0 {
		unix, err := strconv.ParseInt(date[0], 10, 64)
		if err != nil {
			return dh, err
		}
		dh.DeleteAt = time.Unix(unix, 0)
	}
	return dh, nil
}
func (dr DownloadResult) ExtractContent() ([]byte, error) {
	if dr.Err != nil {
		return nil, dr.Err
	}
	body, err := ioutil.ReadAll(dr.Body)
	if err != nil {
		return nil, err
	}
	dr.Body.Close()
	return body, nil
}
type GetHeader struct {
	ContentDisposition string    `mapstructure:"Content-Disposition"`
	ContentEncoding    string    `mapstructure:"Content-Encoding"`
	ContentLength      int64     `mapstructure:"Content-Length"`
	ContentType        string    `mapstructure:"Content-Type"`
	Date               time.Time `mapstructure:"-"`
	DeleteAt           time.Time `mapstructure:"-"`
	ETag               string    `mapstructure:"Etag"`
	LastModified       time.Time `mapstructure:"-"`
	ObjectManifest     string    `mapstructure:"X-Object-Manifest"`
	StaticLargeObject  bool      `mapstructure:"X-Static-Large-Object"`
	TransID            string    `mapstructure:"X-Trans-Id"`
}
type GetResult struct {
	gophercloud.HeaderResult
}
func (gr GetResult) Extract() (GetHeader, error) {
	var gh GetHeader
	if gr.Err != nil {
		return gh, gr.Err
	}
	if err := gophercloud.DecodeHeader(gr.Header, &gh); err != nil {
		return gh, err
	}
	if date, ok := gr.Header["Date"]; ok && len(date) > 0 {
		t, err := time.Parse(time.RFC1123, gr.Header["Date"][0])
		if err != nil {
			return gh, err
		}
		gh.Date = t
	}
	if date, ok := gr.Header["Last-Modified"]; ok && len(date) > 0 {
		t, err := time.Parse(time.RFC1123, gr.Header["Last-Modified"][0])
		if err != nil {
			return gh, err
		}
		gh.LastModified = t
	}
	if date, ok := gr.Header["X-Delete-At"]; ok && len(date) > 0 {
		unix, err := strconv.ParseInt(date[0], 10, 64)
		if err != nil {
			return gh, err
		}
		gh.DeleteAt = time.Unix(unix, 0)
	}
	return gh, nil
}
func (gr GetResult) ExtractMetadata() (map[string]string, error) {
	if gr.Err != nil {
		return nil, gr.Err
	}
	metadata := make(map[string]string)
	for k, v := range gr.Header {
		if strings.HasPrefix(k, "X-Object-Meta-") {
			key := strings.TrimPrefix(k, "X-Object-Meta-")
			metadata[key] = v[0]
		}
	}
	return metadata, nil
}
type CreateHeader struct {
	ContentLength int64     `mapstructure:"Content-Length"`
	ContentType   string    `mapstructure:"Content-Type"`
	Date          time.Time `mapstructure:"-"`
	ETag          string    `mapstructure:"Etag"`
	LastModified  time.Time `mapstructure:"-"`
	TransID       string    `mapstructure:"X-Trans-Id"`
}
type CreateResult struct {
	gophercloud.HeaderResult
}
func (cr CreateResult) Extract() (CreateHeader, error) {
	var ch CreateHeader
	if cr.Err != nil {
		return ch, cr.Err
	}
	if err := gophercloud.DecodeHeader(cr.Header, &ch); err != nil {
		return ch, err
	}
	if date, ok := cr.Header["Date"]; ok && len(date) > 0 {
		t, err := time.Parse(time.RFC1123, cr.Header["Date"][0])
		if err != nil {
			return ch, err
		}
		ch.Date = t
	}
	if date, ok := cr.Header["Last-Modified"]; ok && len(date) > 0 {
		t, err := time.Parse(time.RFC1123, cr.Header["Last-Modified"][0])
		if err != nil {
			return ch, err
		}
		ch.LastModified = t
	}
	return ch, nil
}
type UpdateHeader struct {
	ContentLength int64     `mapstructure:"Content-Length"`
	ContentType   string    `mapstructure:"Content-Type"`
	Date          time.Time `mapstructure:"-"`
	TransID       string    `mapstructure:"X-Trans-Id"`
}
type UpdateResult struct {
	gophercloud.HeaderResult
}
func (ur UpdateResult) Extract() (UpdateHeader, error) {
	var uh UpdateHeader
	if ur.Err != nil {
		return uh, ur.Err
	}
	if err := gophercloud.DecodeHeader(ur.Header, &uh); err != nil {
		return uh, err
	}
	if date, ok := ur.Header["Date"]; ok && len(date) > 0 {
		t, err := time.Parse(time.RFC1123, ur.Header["Date"][0])
		if err != nil {
			return uh, err
		}
		uh.Date = t
	}
	return uh, nil
}
type DeleteHeader struct {
	ContentLength int64     `mapstructure:"Content-Length"`
	ContentType   string    `mapstructure:"Content-Type"`
	Date          time.Time `mapstructure:"-"`
	TransID       string    `mapstructure:"X-Trans-Id"`
}
type DeleteResult struct {
	gophercloud.HeaderResult
}