Skip to content

Latest commit

 

History

History
204 lines (149 loc) · 6.24 KB

File metadata and controls

204 lines (149 loc) · 6.24 KB

API Reference

Complete API documentation for the ACP Mobile codebase.

Auto-Generated API Documentation

!!! note "TypeDoc Generation Required" TypeDoc documentation has not been generated yet. Run npm run docs:api to generate the complete API reference from TypeScript source code.

TypeDoc will generate comprehensive API documentation including:

  • All public classes, interfaces, and types
  • Function signatures and parameters
  • Return types and descriptions
  • Usage examples from code comments
  • Cross-references between related APIs

Quick Reference

Core Services

Authentication

API Clients

Storage

Custom Hooks

Authentication & User

  • useAuth - Authentication state and methods
  • useOffline - Network connectivity status

Sessions

UI State

Components

Session Components

UI Components

  • Badge - Generic badge component
  • Toast - Toast notification component

Layout Components

Type Definitions

Core Types

Realtime Types

Utilities

Building the Documentation

Generate TypeDoc

npm run docs:api

This generates markdown documentation in docs/api/generated/.

View Locally

npm run docs:serve

Then visit http://localhost:8000/api

Deploy to GitHub Pages

npm run docs:deploy

Code Documentation Guidelines

TypeScript Comments

Use TSDoc format for documenting code:

/**
 * Fetches active sessions from the API.
 *
 * @param filters - Optional filters for session status
 * @returns Promise resolving to array of Session objects
 * @throws {APIError} When the API request fails
 *
 * @example
 * ```typescript
 * const sessions = await SessionsAPI.getSessions({ status: 'running' })
 * console.log(`Found ${sessions.length} running sessions`)
 * ```
 */
export async function getSessions(filters?: SessionFilters): Promise<Session[]> {
  // Implementation
}

Documenting Components

/**
 * Session card component displaying session info and progress.
 *
 * @param props - Component props
 * @param props.session - Session data to display
 * @param props.onPress - Optional callback when card is tapped
 *
 * @example
 * ```tsx
 * <SessionCard
 *   session={session}
 *   onPress={() => router.push(`/sessions/${session.id}`)}
 * />
 * ```
 */
export function SessionCard({ session, onPress }: SessionCardProps) {
  // Implementation
}

Documenting Hooks

/**
 * Hook for managing authentication state.
 *
 * Provides methods for login, logout, and tracks authentication status.
 * Automatically refreshes tokens before expiration.
 *
 * @returns Authentication state and methods
 *
 * @example
 * ```tsx
 * function LoginScreen() {
 *   const { login, isAuthenticated, isLoading } = useAuth()
 *
 *   if (isAuthenticated) {
 *     return <Redirect to="/dashboard" />
 *   }
 *
 *   return <Button onPress={login}>Sign In</Button>
 * }
 * ```
 */
export function useAuth() {
  // Implementation
}

Additional Resources


Note: The TypeDoc API documentation is generated automatically from source code comments. To update it, run npm run docs:api after making code changes.