MCPcopy Create free account
hub / github.com/codeaashu/claude-code / paginatedGet

Method paginatedGet

src/cli/transports/ccrClient.ts:864–899  ·  view source on GitHub ↗

* Paginated GET with retry. Fetches all pages from a list endpoint, * retrying each page on failure with exponential backoff + jitter.

(
    path: string,
    params: Record<string, string>,
    context: string,
  )

Source from the content-addressed store, hash-verified

862 * retrying each page on failure with exponential backoff + jitter.
863 */
864 private async paginatedGet(
865 path: string,
866 params: Record<string, string>,
867 context: string,
868 ): Promise<InternalEvent[] | null> {
869 const authHeaders = this.getAuthHeaders()
870 if (Object.keys(authHeaders).length === 0) return null
871
872 const allEvents: InternalEvent[] = []
873 let cursor: string | undefined
874
875 do {
876 const url = new URL(`${this.sessionBaseUrl}${path}`)
877 for (const [k, v] of Object.entries(params)) {
878 url.searchParams.set(k, v)
879 }
880 if (cursor) {
881 url.searchParams.set('cursor', cursor)
882 }
883
884 const page = await this.getWithRetry<ListInternalEventsResponse>(
885 url.toString(),
886 authHeaders,
887 context,
888 )
889 if (!page) return null
890
891 allEvents.push(...(page.data ?? []))
892 cursor = page.next_cursor
893 } while (cursor)
894
895 logForDebugging(
896 `CCRClient: Read ${allEvents.length} internal events from ${path}${params.subagents ? ' (subagents)' : ''}`,
897 )
898 return allEvents
899 }
900
901 /**
902 * Single GET request with retry. Returns the parsed response body

Callers 2

readInternalEventsMethod · 0.95

Calls 6

logForDebuggingFunction · 0.85
keysMethod · 0.80
entriesMethod · 0.80
toStringMethod · 0.65
setMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected