API Reference
Overview
Complete API documentation for Eden TanStack Query
API Reference
This section provides comprehensive documentation for all exports from eden-tanstack-react-query.
Core API
Factory Function
| Export | Description |
|---|---|
createEdenTanStackQuery | Main factory that creates typed providers and hooks |
Hooks
| Export | Description |
|---|---|
useEden | Hook returning the options proxy with decorated routes |
useEdenClient | Hook returning the raw Eden Treaty client |
Options Factories
| Export | Description |
|---|---|
queryOptions | Method on query routes for creating query options |
mutationOptions | Method on mutation routes for creating mutation options |
infiniteQueryOptions | Method on supported non-union cursor routes for creating infinite query options |
Query Keys
| Export | Description |
|---|---|
getQueryKey | Generate query keys from path and input |
getMutationKey | Generate mutation keys from path |
Types
| Export | Description |
|---|---|
EdenQueryKey | Query key structure type |
EdenMutationKey | Mutation key structure type |
EdenFetchError | Error type for Eden requests |
RouteDefinition | Base route type structure |
Quick Reference
Query Routes (GET, HEAD, OPTIONS)
const eden = useEden()
// Available methods on query routes
eden.users.get.queryOptions(input, opts?) // Input is conditional on the route query
eden.users.get.queryKey(input?) // For cache operations
eden.users.get.queryFilter(input?, filters?) // For invalidation
// Available for a non-union query schema with a usable top-level cursor field
eden.posts.get.infiniteQueryOptions(input, opts) // For useInfiniteQuery
eden.posts.get.infiniteQueryKey(input?, keyOpts?) // For cache operations
eden.posts.get.infiniteQueryFilter(input?, filters?)Mutation Routes (POST, PUT, PATCH, DELETE)
// Available methods on mutation routes
eden.users.post.mutationOptions(opts?) // For useMutation
eden.users.post.mutationKey() // For cache operationsPath Parameters
// For routes with path params like /users/:id
eden.users({ id: '123' }).get.queryOptions()
// Nested params: /posts/:postId/comments/:commentId
eden.posts({ postId: '1' }).comments({ commentId: '2' }).get.queryOptions()Package Exports
All public APIs are exported from the main package entry point:
import {
// Main factory
createEdenTanStackQuery,
// Low-level factories (for advanced use)
edenQueryOptions,
edenMutationOptions,
edenInfiniteQueryOptions,
// Query key utilities
getQueryKey,
getMutationKey,
// Types
type EdenQueryKey,
type EdenMutationKey,
type EdenFetchError,
type RouteDefinition,
type EdenOptionsProxy,
// ... and more
} from 'eden-tanstack-react-query'