Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
nechvatalp authored Apr 18, 2023
1 parent a6271be commit 0fc382f
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 0fc382f

Please sign in to comment.