@@ -1614,19 +1614,20 @@ export class SentryApiService {
16141614 }
16151615
16161616 /**
1617- * Lists all organizations accessible to the authenticated user.
1617+ * Lists a page of organizations accessible to the authenticated user.
16181618 *
16191619 * Queries the `/organizations/` endpoint on the root host.
16201620 *
16211621 * @param params Query parameters
16221622 * @param params.query Search query to filter organizations by name/slug
16231623 * @param params.limit Maximum number of organizations to return (defaults to 25)
1624- * @returns Array of organizations across all accessible regions
1624+ * @param params.cursor Pagination cursor from a previous call's nextCursor
1625+ * @returns A page of organizations across all accessible regions, plus a cursor for the next page (null once exhausted)
16251626 *
16261627 * @example
16271628 * ```typescript
1628- * const orgs = await apiService.listOrganizations();
1629- * orgs .forEach(org => {
1629+ * const { organizations } = await apiService.listOrganizations();
1630+ * organizations .forEach(org => {
16301631 * // regionUrl present for Cloud Service, empty for self-hosted
16311632 * console.log(`${org.name} (${org.slug}) - ${org.links?.regionUrl || 'No region URL'}`);
16321633 * });
@@ -1635,7 +1636,8 @@ export class SentryApiService {
16351636 async listOrganizations ( params ?: {
16361637 query ?: string ;
16371638 limit ?: number ;
1638- } ) : Promise < OrganizationList > {
1639+ cursor ?: string | null ;
1640+ } ) : Promise < { organizations : OrganizationList ; nextCursor : string | null } > {
16391641 const limit = params ?. limit ?? 25 ;
16401642
16411643 // Build query parameters
@@ -1644,6 +1646,9 @@ export class SentryApiService {
16441646 if ( params ?. query ) {
16451647 queryParams . set ( "query" , params . query ) ;
16461648 }
1649+ if ( params ?. cursor ) {
1650+ queryParams . set ( "cursor" , params . cursor ) ;
1651+ }
16471652 const queryString = queryParams . toString ( ) ;
16481653 const path = `/organizations/?${ queryString } ` ;
16491654
@@ -1654,8 +1659,13 @@ export class SentryApiService {
16541659 host = "sentry.io" ;
16551660 }
16561661
1657- const body = await this . requestJSON ( path , undefined , { host } ) ;
1658- return OrganizationListSchema . parse ( body ) ;
1662+ const response = await this . request ( path , undefined , { host } ) ;
1663+ const body = await this . parseJsonResponse ( response ) ;
1664+
1665+ return {
1666+ organizations : OrganizationListSchema . parse ( body ) ,
1667+ nextCursor : getNextCursor ( response . headers . get ( "link" ) ) ,
1668+ } ;
16591669 }
16601670
16611671 /**
@@ -1675,31 +1685,40 @@ export class SentryApiService {
16751685 }
16761686
16771687 /**
1678- * Lists teams within an organization.
1688+ * Lists a page of teams within an organization.
16791689 *
16801690 * @param organizationSlug Organization identifier
16811691 * @param params Query parameters
16821692 * @param params.query Search query to filter teams by name/slug
16831693 * @param params.limit Maximum number of teams to return
1694+ * @param params.cursor Pagination cursor from a previous call's nextCursor
16841695 * @param opts Request options including host override
1685- * @returns Array of teams in the organization
1696+ * @returns A page of teams in the organization, plus a cursor for the next page (null once exhausted)
16861697 */
16871698 async listTeams (
16881699 organizationSlug : string ,
1689- params ?: { query ?: string ; limit ?: number } ,
1700+ params ?: { query ?: string ; limit ?: number ; cursor ?: string | null } ,
16901701 opts ?: RequestOptions ,
1691- ) : Promise < TeamList > {
1702+ ) : Promise < { teams : TeamList ; nextCursor : string | null } > {
16921703 const queryParams = new URLSearchParams ( ) ;
16931704 queryParams . set ( "per_page" , String ( params ?. limit ?? 25 ) ) ;
16941705 if ( params ?. query ) {
16951706 queryParams . set ( "query" , params . query ) ;
16961707 }
1708+ if ( params ?. cursor ) {
1709+ queryParams . set ( "cursor" , params . cursor ) ;
1710+ }
16971711 const queryString = queryParams . toString ( ) ;
16981712 const teamsPath = apiPath `/organizations/${ organizationSlug } /teams/` ;
16991713 const path = `${ teamsPath } ?${ queryString } ` ;
17001714
1701- const body = await this . requestJSON ( path , undefined , opts ) ;
1702- return TeamListSchema . parse ( body ) ;
1715+ const response = await this . request ( path , undefined , opts ) ;
1716+ const body = await this . parseJsonResponse ( response ) ;
1717+
1718+ return {
1719+ teams : TeamListSchema . parse ( body ) ,
1720+ nextCursor : getNextCursor ( response . headers . get ( "link" ) ) ,
1721+ } ;
17031722 }
17041723
17051724 /**
@@ -1740,25 +1759,34 @@ export class SentryApiService {
17401759 * @param params Query parameters
17411760 * @param params.query Search query to filter projects by name/slug
17421761 * @param params.limit Maximum number of projects to return
1762+ * @param params.cursor Pagination cursor from a previous call's nextCursor
17431763 * @param opts Request options
1744- * @returns Array of projects in the organization
1764+ * @returns Projects in the organization, plus a cursor for the next page (null once exhausted)
17451765 */
17461766 async listProjects (
17471767 organizationSlug : string ,
1748- params ?: { query ?: string ; limit ?: number } ,
1768+ params ?: { query ?: string ; limit ?: number ; cursor ?: string | null } ,
17491769 opts ?: RequestOptions ,
1750- ) : Promise < ProjectList > {
1770+ ) : Promise < { projects : ProjectList ; nextCursor : string | null } > {
17511771 const queryParams = new URLSearchParams ( ) ;
17521772 queryParams . set ( "per_page" , String ( params ?. limit ?? 25 ) ) ;
17531773 if ( params ?. query ) {
17541774 queryParams . set ( "query" , params . query ) ;
17551775 }
1776+ if ( params ?. cursor ) {
1777+ queryParams . set ( "cursor" , params . cursor ) ;
1778+ }
17561779 const queryString = queryParams . toString ( ) ;
17571780 const projectsPath = apiPath `/organizations/${ organizationSlug } /projects/` ;
17581781 const path = `${ projectsPath } ?${ queryString } ` ;
17591782
1760- const body = await this . requestJSON ( path , undefined , opts ) ;
1761- return ProjectListSchema . parse ( body ) ;
1783+ const response = await this . request ( path , undefined , opts ) ;
1784+ const body = await this . parseJsonResponse ( response ) ;
1785+
1786+ return {
1787+ projects : ProjectListSchema . parse ( body ) ,
1788+ nextCursor : getNextCursor ( response . headers . get ( "link" ) ) ,
1789+ } ;
17621790 }
17631791
17641792 async listDashboards (
0 commit comments