// Construct a FileClient given a file identifier and APIClient func NewFileClient(c *api.Client, fileId string, fields []string) (*FileClient, error) { body, header, err := c.GetFileMetadata(fileId, fields) if err != nil { return nil, err } f := FileClient{APIClient: c, OnDemand: fields} err = json.Unmarshal(body, &f.Desc) if err != nil { return nil, errors.New("Unable to unmarshal existing File") } f.Desc.Etag = header.Get("ETag") return &f, nil }