I am using the list permissions endpoint (https://developers.google.com/drive/api/v3/reference/permissions/list) to get all the permissions for a file that exists in a shared drive.
I am running into an issue with a file I have that lives in a shared drive. The file has 100 permissions. The max limit on the number of permissions returned for a shared drive file is 100, so I should only need to make one request to get all the permissions for the file and the API should not return a next page token.
But this is not the behaviour I am experiencing, after the first request I continuously get the same next page token back from the API.
So for the following code below (written in go), I get into an infinite loop, since I continuously get the same next page token back.
var permissionService PermissionsService := getPermissionsService() fileID := "1234abcd" nextPageToken := "" anotherPage := true permissions := []*Permission{} for anotherPage { result, err := permissionService. List(fileID). SupportsAllDrives(true). SupportsTeamDrives(false). Fields("*"). PageSize(100). Do() if err != nil { panic(err) } anotherPage = result.NextPageToken != "" nextPageToken = result.NextPageToken permissions = append(permissions, result.Permissions...) } fmt.Println("Permissions", permissions) Am I supposed to account for this case in my code? From the documentation, this is never mentioned so I assume this is not supposed to happen.