MCPcopy Index your code
hub / github.com/codeaashu/claude-code / listFilesCreatedAfter

Function listFilesCreatedAfter

src/services/api/filesApi.ts:617–709  ·  view source on GitHub ↗
(
  afterCreatedAt: string,
  config: FilesApiConfig,
)

Source from the content-addressed store, hash-verified

615 * @returns Array of file metadata for files created after the timestamp
616 */
617export async function listFilesCreatedAfter(
618 afterCreatedAt: string,
619 config: FilesApiConfig,
620): Promise<FileMetadata[]> {
621 const baseUrl = config.baseUrl || getDefaultApiBaseUrl()
622 const headers = {
623 Authorization: `Bearer ${config.oauthToken}`,
624 'anthropic-version': ANTHROPIC_VERSION,
625 'anthropic-beta': FILES_API_BETA_HEADER,
626 }
627
628 logDebug(`Listing files created after ${afterCreatedAt}`)
629
630 const allFiles: FileMetadata[] = []
631 let afterId: string | undefined
632
633 // Paginate through results
634 while (true) {
635 const params: Record<string, string> = {
636 after_created_at: afterCreatedAt,
637 }
638 if (afterId) {
639 params.after_id = afterId
640 }
641
642 const page = await retryWithBackoff(
643 `List files after ${afterCreatedAt}`,
644 async () => {
645 try {
646 const response = await axios.get(`${baseUrl}/v1/files`, {
647 headers,
648 params,
649 timeout: 60000,
650 validateStatus: status => status < 500,
651 })
652
653 if (response.status === 200) {
654 return { done: true, value: response.data }
655 }
656
657 if (response.status === 401) {
658 logEvent('tengu_file_list_failed', {
659 error_type:
660 'auth' as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
661 })
662 throw new Error('Authentication failed: invalid or missing API key')
663 }
664 if (response.status === 403) {
665 logEvent('tengu_file_list_failed', {
666 error_type:
667 'forbidden' as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
668 })
669 throw new Error('Access denied to list files')
670 }
671
672 return { done: false, error: `status ${response.status}` }
673 } catch (error) {
674 if (!axios.isAxiosError(error)) {

Callers

nothing calls this directly

Calls 6

getDefaultApiBaseUrlFunction · 0.85
retryWithBackoffFunction · 0.85
logEventFunction · 0.85
logDebugFunction · 0.70
getMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected