vsteam icon indicating copy to clipboard operation
vsteam copied to clipboard

Implement continuationToken management (body and headers) on v8.0.0 branch

Open mnieto opened this issue 2 years ago • 1 comments

PR Summary

Some endpoints in Azure DevOps APIs version 6.0 and above use continuationToken as part of the body response or X-MS-ContinuationToken header

In both cases it is possible provide this functionality adding the following parameters to the _callAPI function

  • [string]$UseContinuationToken = 'None' Posible values: None, Header, Body
  • [string]$ContinuationTokenName Allows to specify a header or continuation token property different of the default values. If this parameter is not specified, the default value is X-MS-ContinuationToken or continuationToken depending if $UseHeader is present or not, respectively. Ignored if $UseContinuationToken -eq 'None'
  • [int]$MaxPages = 0 Number of pages to be retrieved. If 0, or not specified, it will return all the available pages. Ignored if $UseContinuationToken -eq 'None'
  • [string]$ColectionPropertyName When using continuationToken, it is neccesary expand a specific property to get the real collection of objects. Ignored if $UseContinuationToken -eq 'None'

IMPORTANT: Managing response headers in the Invoke-RestMethod cmdlet forces to use only poweshell core. This required functionality was introduced in powershell core v6 and it is not available in Desktop flavour.

With this changes it is not necessary to maintain a separated __callAPIContinuationToken function. As part of the PR I want to update the Get-VSTeamUser and Get-VSTeamUserEntitlement functions mentioned in the below issues.

This change enables the possibility to fix at least the below issues:

  • #412
  • #388 Already fixed with a partial implementation
  • #169

PR Checklist

mnieto avatar Jan 06 '23 00:01 mnieto

@SebastianSchuetze, perhaps it could be a good idea to announce, in addition to #458 the removal of support to Powershell Desktop in the v8.x version

mnieto avatar Jan 06 '23 00:01 mnieto