I have some code that is based on the following Golang example at https://developers.google.com/drive/v2/reference/files/insert.
// InsertFile creates a new file in Drive from the given file and details
func InsertFile(d *drive.Service, title string, description string,
parentId string, mimeType string, filename string) (*drive.File, error) {
.
.
.
f := &drive.File{Title: title, Description: description, MimeType: mimeType}
if parentId != "" {
p := &drive.ParentReference{Id: parentId}
f.Parents = []*drive.ParentReference{p}
}
r, err := d.Files.Insert(f).Media(m).Do()
if err != nil {
fmt.Printf("An error occurred: %v
", err)
return nil, err
}
return r, nil
}
When I switch to version 3, the errors below are thrown.
./main.go:125: unknown drive.File field 'Title' in struct literal
./main.go:127: undefined: drive.ParentReference
./main.go:128: undefined: drive.ParentReference
./main.go:131: service.Files.Insert undefined (type *drive.FilesService has no field or method Insert)
I know that Title should be changed to Name in the first error but I'm not sure what replaced drive.ParentReference or service.Files.Insert in Version 3 of the SDK and I haven't been able to find anything equivalent to the link above in the V3 docs.