Skip to content

How to page through memberentitlementmanagement SearchUserEntitlements() results? #191

Open
@jbiel

Description

@jbiel

Does anyone have any examples of how to page through memberentitlementmanagement SearchUserEntitlements() results? According to the docs a ContinuationToken should be used for paging, but that's not exposed in return value that I can see. I originally posted a thread here and was redirected to the github issues for this project. Thanks!

package main

import (
	"context"
	"os"

	"github.com/microsoft/azure-devops-go-api/azuredevops/v7"
	"github.com/microsoft/azure-devops-go-api/azuredevops/v7/memberentitlementmanagement"
)

func main() {
	org := os.Getenv("AZURE_DEVOPS_ORGANIZATION_URL")
	pat := os.Getenv("AZURE_DEVOPS_PERSONAL_ACCESS_TOKEN")

	// Initialize the client
	connection := azuredevops.NewPatConnection(org, pat)
	client, _ := memberentitlementmanagement.NewClient(context.Background(), connection)

	// Create search args
	options := memberentitlementmanagement.SearchUserEntitlementsArgs{ContinuationToken: nil}

	// Get the current page of results
	response, _ := client.SearchUserEntitlements(context.Background(), options)

	// This is an invalid parameter. Where can I get it?
	if response.ContinuationToken != nil {
		// we have all responses
	} else {
		// need to get the next page
	}

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions