Client SDK Usage Guide
Client SDK Usage Guide
This guide demonstrates how to use the ObjectQL TypeScript client SDK to interact with Data API and Metadata API from frontend applications.
Installation
Overview
The @objectql/sdk package provides two main client classes:
DataApiClient- For CRUD operations on data recordsMetadataApiClient- For reading object schemas and metadata
All types are defined in @objectql/types to maintain zero dependencies and enable frontend usage.
Data API Client
Basic Setup
List Records
Get Single Record
Create Record
Create Multiple Records
Update Record
Bulk Update
Delete Record
Bulk Delete
Count Records
Metadata API Client
Basic Setup
List All Objects
Get Object Schema
Get Field Metadata
List Object Actions
List Custom Metadata
Get Specific Metadata
Error Handling
All API methods throw errors with structured information:
React Example
Custom Hook for Data Fetching
Using the Hook
Custom Hook for Metadata
Dynamic Form Generator
Vue.js Example
Composable for Data Fetching
Advanced Filtering
Complex Filter Expressions
Expanding Relations
Type Safety Benefits
By using the type definitions from @objectql/types, you get:
- Autocomplete - IDEs provide intelligent suggestions
- Type Checking - Catch errors at compile time
- Documentation - Inline JSDoc comments explain each field
- Refactoring - Safely rename and restructure code
Best Practices
-
Centralize Client Instances
-
Use Generic Types
-
Handle Errors Gracefully
-
Cache Metadata
-
Use Environment Variables
Summary
The ObjectQL client SDK provides:
- ✅ Type-safe API clients for Data and Metadata operations
- ✅ Zero dependencies in
@objectql/typesfor frontend compatibility - ✅ RESTful interface matching the server implementation
- ✅ Framework agnostic - works with React, Vue, Angular, etc.
- ✅ Full TypeScript support with generics and inference
For more information, see: