This commit is contained in:
Petr Nechvátal 2023-04-18 07:37:16 +02:00 коммит произвёл GitHub
Родитель a6271be3ed
Коммит 0fc382fb32
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 13 добавлений и 5 удалений

Просмотреть файл

@ -13,14 +13,16 @@ package main
import (
"context"
"github.com/microsoft/azure-devops-go-api/azuredevops"
"github.com/microsoft/azure-devops-go-api/azuredevops/core"
"log"
"strconv"
"github.com/microsoft/azure-devops-go-api/azuredevops/v7"
"github.com/microsoft/azure-devops-go-api/azuredevops/v7/core"
)
func main() {
organizationUrl := "https://dev.azure.com/myorg" // todo: replace value with your organization url
personalAccessToken := "XXXXXXXXXXXXXXXXXXXXXXX" // todo: replace value with your PAT
organizationUrl := "https://dev.azure.com/myorg" // todo: replace value with your organization url
personalAccessToken := "XXXXXXXXXXXXXXXXXXXXXXX" // todo: replace value with your PAT
// Create a connection to your organization
connection := azuredevops.NewPatConnection(organizationUrl, personalAccessToken)
@ -49,9 +51,15 @@ func main() {
// if continuationToken has a value, then there is at least one more page of projects to get
if responseValue.ContinuationToken != "" {
continuationToken, err := strconv.Atoi(responseValue.ContinuationToken)
if err != nil {
log.Fatal(err)
}
// Get next page of team projects
projectArgs := core.GetProjectsArgs{
ContinuationToken: &responseValue.ContinuationToken,
ContinuationToken: &continuationToken,
}
responseValue, err = coreClient.GetProjects(ctx, projectArgs)
if err != nil {