Hooks
iOSAndroidExpo Go
Installation
pnpm dlx @docyrus/cli add @docyrus/rn-hooks-use-docyrus-agent-projectsRequired Packages(1 package)
pnpm add @tanstack/react-queryA verbatim port of the web hook. Endpoints: GET /v1/ai/projects, POST /v1/ai/projects ({ name, description?, tenant_ai_agent_id }), PATCH /v1/ai/projects/{id} ({ name }), DELETE /v1/ai/projects/{id}. The list is filtered client-side to the agent (and to userId when given). Pair it with DocyrusAgentProjectsView / DocyrusAgentSidebarProjectsSection.
Usage
import { DocyrusAgentProjectsView } from '@/components/docyrus-native/docyrus-agent';
import { useDocyrusAgentProjects } from '@/hooks/docyrus-native/use-docyrus-agent-projects';
const { projects, createProject, deleteProject } = useDocyrusAgentProjects({ client, agentId: AGENT_ID });API Reference
UseDocyrusAgentProjectsArgs
| Option | Type | Default | Description |
|---|---|---|---|
client | DocyrusAgentProjectsClient | null | undefined | - | Client with get / post / patch / delete |
agentId | string | - | Tenant AI agent ID (required) |
userId | string | null | null | Only projects owned by / shared with this user |
enabled | boolean | !!client | Toggle the list query |
UseDocyrusAgentProjectsResult
| Field | Type | Description |
|---|---|---|
projects | DocyrusAgentProject[] | { id, name, description?, agentId?, deploymentId?, createdBy?, sharedTo? } |
isLoading / error | boolean / Error | null | List query state |
refresh | () => Promise<void> | Invalidate the list |
createProject | (input: CreateProjectInput) => Promise<DocyrusAgentProject | null> | { name, description? } |
isCreating | boolean | Create pending |
renameProject | (projectId, name) => Promise<boolean> | Rename |
isRenaming | boolean | Rename pending |
deleteProject | (projectId) => Promise<boolean> | Delete |
isDeleting | boolean | Delete pending |