Skip to content

Commit

Permalink
Change objecttype list cmd back to returning array of types + add pag…
Browse files Browse the repository at this point in the history
…ination for objecttypes (#49)
  • Loading branch information
akajla09 authored Jan 5, 2024
1 parent 38dcb5b commit 81b172f
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions internal/cmd/objecttype.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,21 @@ warrant objecttype list`,
WarrantToken: listObjecttypeWarrantToken,
}
}
types, err := objecttype.ListObjectTypes(listParams)
if err != nil {
return err

// Fetch all objecttypes (paginate if necessary)
var types []warrant.ObjectType
for {
typesResp, err := objecttype.ListObjectTypes(listParams)
if err != nil {
return err
}
types = append(types, typesResp.Results...)

if typesResp.NextCursor == "" {
break
} else {
listParams.NextCursor = typesResp.NextCursor
}
}
printer.PrintJson(types)

Expand Down

0 comments on commit 81b172f

Please sign in to comment.