jfcote87/google-api-go-client

Google drive batch permission request

Opened this issue · 0 comments

Hi Jim,

I'm trying to do the following

	bsv := batch.Service{Client: c}
	srv, err := drive.New(batch.BatchClient)
	if err != nil {
		return err
	}

	for _, email := range []string{"email1@gmail.com", "email2@gmail.com"} {

		p := &drive.Permission{
			Role:         "writer", 
			Type:         "user", 
			EmailAddress: email,
		}

	       p, err = srv.Permissions.Create(folderID, p).SendNotificationEmail(false).Do()
               if err != nil {
			return err
		}
		err = bsv.AddRequest(err, batch.SetResult(p), batch.SetTag([]string{email}))
		if err != nil {
			return err
		}
	}

	ctx := context.Background()
	_, err = bsv.DoCtx(ctx)

But I'm getting an error (for p, err = srv.Permissions.Create(folderID, p).SendNotificationEmail(false).Do()) with value

Post https://www.googleapis.com/drive/v3/files/************/permissions?alt=json&sendNotificationEmail=false: Batched Request: POST /drive/v3/files/*************/permissions?alt=json&sendNotificationEmail=false

Could you help me along and see what I do wrong?
FYI: If I execute the the calls in a single (non batched) srv, everything does work...
PS: if there is a native way of doing batch calls for the drive API, let me know, but AFAIK I did not see any (and as the current golang client seems in maintenance mode, it won't be coming soon..)