func (b *Bucket) ListFilesVersions(fromName, fromID string) *Listing {
	if fromName == "" && fromID != "" {
		return &Listing{
			err: errors.New("can't set fromID if fromName is not set"),
		}
	}
	return &Listing{
		b:        b,
		versions: true,
		nextName: &fromName,
		nextID:   &fromID,
	}
}
ListFilesVersions is like ListFiles, but returns all file versions,
alphabetically sorted first, and by reverse of date/time uploaded then.

If fromID is specified, the name-and-id pair is the starting point.
package b2
import (
	"encoding/json"
	"errors"
	"time"
)
func (c *Client) DeleteFile(id, name string) error {
	res, err := c.doRequest("b2_delete_file_version", map[string]interface{}{
		"fileId": id, "fileName": name,
	})
	if err != nil {
		return err
	}
	drainAndClose(res.Body)
	return nil
}
type FileInfo struct {
	ID   string
	Name string
	ContentSHA1   string  
	ContentLength int
	ContentType   string
	CustomMetadata  map[string]interface{}
	UploadTimestamp time.Time
	Action string
}
type fileInfoObj struct {
	AccountID       string                 `json:"accountId"`
	BucketID        string                 `json:"bucketId"`
	ContentLength   int                    `json:"contentLength"`
	ContentSHA1     string                 `json:"contentSha1"`
	ContentType     string                 `json:"contentType"`
	FileID          string                 `json:"fileId"`
	FileInfo        map[string]interface{} `json:"fileInfo"`
	FileName        string                 `json:"fileName"`
	UploadTimestamp int64                  `json:"uploadTimestamp"`
	Action          string                 `json:"action"`
}
func (fi *fileInfoObj) makeFileInfo() *FileInfo {
	return &FileInfo{
		ID:              fi.FileID,
		Name:            fi.FileName,
		ContentLength:   fi.ContentLength,
		ContentSHA1:     fi.ContentSHA1,
		ContentType:     fi.ContentType,
		CustomMetadata:  fi.FileInfo,
		Action:          fi.Action,
		UploadTimestamp: time.Unix(fi.UploadTimestamp/1e3, fi.UploadTimestamp%1e3*1e6),
	}
}
func (c *Client) GetFileInfoByID(id string) (*FileInfo, error) {
	res, err := c.doRequest("b2_get_file_info", map[string]interface{}{
		"fileId": id,
	})
	if err != nil {
		return nil, err
	}
	defer drainAndClose(res.Body)
	var fi *fileInfoObj
	if err := json.NewDecoder(res.Body).Decode(&fi); err != nil {
		return nil, err
	}
	return fi.makeFileInfo(), nil
}
var FileNotFoundError = errors.New("no file with the given name in the bucket")
func (b *Bucket) GetFileInfoByName(name string) (*FileInfo, error) {
	l := b.ListFiles(name)
	l.SetPageCount(1)
	if l.Next() {
		if l.FileInfo().Name == name {
			return l.FileInfo(), nil
		}
	}
	if err := l.Err(); err != nil {
		return nil, l.Err()
	}
	return nil, FileNotFoundError
}
type Listing struct {
	b                *Bucket
	versions         bool
	nextPageCount    int
	nextName, nextID *string
	objects          []*FileInfo  
	err              error
}
func (l *Listing) SetPageCount(n int) {
	if n > 1000 {
		n = 1000
	}
	l.nextPageCount = n
}
func (l *Listing) Next() bool {
	if l.err != nil {
		return false
	}
	if len(l.objects) > 0 {
		l.objects = l.objects[:len(l.objects)-1]
	}
	if len(l.objects) > 0 {
		return true
	}
	if l.nextName == nil {
		return false  
	}
	data := map[string]interface{}{
		"bucketId":      l.b.ID,
		"startFileName": *l.nextName,
		"maxFileCount":  l.nextPageCount,
	}
	endpoint := "b2_list_file_names"
	if l.versions {
		endpoint = "b2_list_file_versions"
	}
	if l.nextID != nil && *l.nextID != "" {
		data["startFileId"] = *l.nextID
	}
	r, err := l.b.c.doRequest(endpoint, data)
	if err != nil {
		l.err = err
		return false
	}
	defer drainAndClose(r.Body)
	var x struct {
		Files        []fileInfoObj
		NextFileName *string
		NextFileID   *string
	}
	if l.err = json.NewDecoder(r.Body).Decode(&x); l.err != nil {
		return false
	}
	l.objects = make([]*FileInfo, len(x.Files))
	for i, f := range x.Files {
		l.objects[len(l.objects)-1-i] = f.makeFileInfo()
	}
	l.nextName, l.nextID = x.NextFileName, x.NextFileID
	return len(l.objects) > 0
}
func (l *Listing) FileInfo() *FileInfo {
	return l.objects[len(l.objects)-1]
}
func (l *Listing) Err() error {
	return l.err
}
func (b *Bucket) ListFiles(fromName string) *Listing {
	return &Listing{
		b:        b,
		nextName: &fromName,
	}
}