Eden TanStack Query
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

ExportDescription
createEdenTanStackQueryMain factory that creates typed providers and hooks

Hooks

ExportDescription
useEdenHook returning the options proxy with decorated routes
useEdenClientHook returning the raw Eden Treaty client

Options Factories

ExportDescription
queryOptionsMethod on query routes for creating query options
mutationOptionsMethod on mutation routes for creating mutation options
infiniteQueryOptionsMethod on query routes for creating infinite query options

Query Keys

ExportDescription
getQueryKeyGenerate query keys from path and input
getMutationKeyGenerate mutation keys from path

Types

ExportDescription
EdenQueryKeyQuery key structure type
EdenMutationKeyMutation key structure type
EdenFetchErrorError type for Eden requests
RouteDefinitionBase route type structure

Quick Reference

Query Routes (GET, HEAD, OPTIONS)

const eden = useEden()

// Available methods on query routes
eden.users.get.queryOptions(input?, opts?)     // For useQuery
eden.users.get.queryKey(input?)                // For cache operations
eden.users.get.queryFilter(input?, filters?)   // For invalidation

// For paginated data (when input has cursor)
eden.posts.get.infiniteQueryOptions(input, opts)  // For useInfiniteQuery
eden.posts.get.infiniteQueryKey(input?)           // 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 operations

Path 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'

On this page