diff --git a/skills/base44-sdk/SKILL.md b/skills/base44-sdk/SKILL.md index 01ddd7f..f71fe39 100644 --- a/skills/base44-sdk/SKILL.md +++ b/skills/base44-sdk/SKILL.md @@ -140,7 +140,13 @@ Base44 SDK has unique method names. Do NOT assume patterns from Firebase, Supaba For client setup and authentication modes, see [client.md](references/client.md). -**TypeScript Support:** Each reference file includes a "Type Definitions" section with TypeScript interfaces and types for the module's methods, parameters, and return values. +### TypeScript and type registries + +Each reference file includes a "Type Definitions" section with TypeScript interfaces and types for the module's methods, parameters, and return values. + +**Getting typed entities, functions, and agents:** The Base44 CLI generates types from your project resources (entities, functions, agents), including augmentations to `EntityTypeRegistry`, `FunctionNameRegistry`, and `AgentNameRegistry`, and wires them into your project so you get autocomplete and type checking without manual setup. For how to generate types, use the **base44-cli** skill. + +**Manual augmentation:** You can instead augment the registries yourself in a `.d.ts` file; see the Type Definitions sections in [entities.md](references/entities.md), [functions.md](references/functions.md), and [base44-agents.md](references/base44-agents.md). ## Installation diff --git a/skills/base44-sdk/references/QUICK_REFERENCE.md b/skills/base44-sdk/references/QUICK_REFERENCE.md index d357384..2a8a2c8 100644 --- a/skills/base44-sdk/references/QUICK_REFERENCE.md +++ b/skills/base44-sdk/references/QUICK_REFERENCE.md @@ -29,26 +29,26 @@ setToken(token, saveToStorage?) → void ## Entities (`base44.entities.EntityName.*`) ``` -create(data) → Promise -bulkCreate(dataArray) → Promise -list(sort?, limit?, skip?, fields?) → Promise -filter(query, sort?, limit?, skip?, fields?) → Promise -get(id) → Promise -update(id, data) → Promise -delete(id) → Promise -deleteMany(query) → Promise -importEntities(file) → Promise // frontend only -subscribe(callback) → () => void // returns unsubscribe fn +create(data) → Promise +bulkCreate(dataArray) → Promise +list(sort?, limit?, skip?, fields?) → Promise[]> +filter(query, sort?, limit?, skip?, fields?) → Promise[]> +get(id) → Promise +update(id, data) → Promise +delete(id) → Promise +deleteMany(query) → Promise +importEntities(file) → Promise> // frontend only +subscribe(callback) → () => void // returns unsubscribe fn ``` -**Sort:** Use `-fieldName` for descending (e.g., `-created_date`) +**Sort:** Use `SortField`: `-fieldName` for descending (e.g., `-created_date`). Max 5,000 per request for list/filter. --- ## Functions (`base44.functions.*`) ``` -invoke(functionName, data) → Promise +invoke(functionName, data?) → Promise ``` **Backend:** Use `base44.asServiceRole.functions.invoke()` for admin access. @@ -70,7 +70,7 @@ ExtractDataFromUploadedFile({file_url, json_schema}) → Promise ### Custom Integrations (`base44.integrations.custom.*`) ``` -call(slug, operationId, {payload?, pathParams?, queryParams?, headers?}?) → Promise<{success, status_code, data}> +call(slug, operationId, {payload?, pathParams?, queryParams?}?) → Promise<{success, status_code, data}> ``` **operationId format:** `"method:/path"` (e.g., `"get:/contacts"`, `"post:/users/{id}"`) @@ -153,3 +153,9 @@ import { createClient } from "@base44/sdk"; const base44 = createClient({ appId: "your-app-id" }); // MUST use 'appId' ``` + +--- + +## TypeScript type registries + +For typed entities, function names, and agent names (autocomplete and type checking), the Base44 CLI generates types and wires them into your project. Use the **base44-cli** skill for how to generate types. diff --git a/skills/base44-sdk/references/auth.md b/skills/base44-sdk/references/auth.md index 5195b3a..ad3c43d 100644 --- a/skills/base44-sdk/references/auth.md +++ b/skills/base44-sdk/references/auth.md @@ -125,10 +125,10 @@ interface AuthModule { |--------|-----------|-------------|-------------| | `register()` | `params: RegisterParams` | `Promise` | Create new user account | | `loginViaEmailPassword()` | `email: string, password: string, turnstileToken?: string` | `Promise` | Authenticate with email/password | -| `loginWithProvider()` | `provider: Provider, fromUrl?: string` | `void` | Initiate OAuth login flow | +| `loginWithProvider()` | `provider: Provider, fromUrl?: string` | `void` | Initiate OAuth login flow. Providers: `'google'` (default), `'microsoft'`, `'facebook'` (enable in app settings) | | `me()` | None | `Promise` | Get current authenticated user | | `updateMe()` | `data: Partial` | `Promise` | Update current user's profile | -| `logout()` | `redirectUrl?: string` | `void` | Clear session, optionally redirect | +| `logout()` | `redirectUrl?: string` | `void` | Redirect to server-side logout (clears HTTP-only cookies and session), then to redirectUrl or current URL | | `redirectToLogin()` | `nextUrl: string` | `void` | ⚠️ **Avoid** - Prefer custom login UI with `loginViaEmailPassword()` or `loginWithProvider()` | | `isAuthenticated()` | None | `Promise` | Check if user is logged in | | `setToken()` | `token: string, saveToStorage?: boolean` | `void` | Manually set auth token | @@ -215,6 +215,8 @@ try { ### Login with OAuth Provider +Supported providers: `'google'` (enabled by default), `'microsoft'`, and `'facebook'`. Enable Microsoft or Facebook in your app's authentication settings before using them. + ```javascript // Redirect to Google OAuth base44.auth.loginWithProvider('google'); @@ -222,8 +224,9 @@ base44.auth.loginWithProvider('google'); // Redirect to Google OAuth and return to current page after base44.auth.loginWithProvider('google', window.location.href); -// Supported providers: 'google', 'microsoft', 'facebook' +// Microsoft or Facebook (enable in app settings first) base44.auth.loginWithProvider('microsoft'); +base44.auth.loginWithProvider('facebook', '/dashboard'); ``` ### Get Current User @@ -297,11 +300,13 @@ try { ### Logout +Logout redirects the user to the server-side logout endpoint (`/api/apps/auth/logout`) to clear HTTP-only cookies and the session, then redirects to the given URL (or the current page if omitted). Requires a browser environment. + ```javascript -// Simple logout +// Logout: clears session via server, then redirects to current page base44.auth.logout(); -// Logout and redirect to goodbye page +// Logout and redirect to goodbye page after base44.auth.logout("/goodbye"); // Logout and redirect to homepage @@ -592,6 +597,10 @@ Configure authentication providers in your app dashboard: ### Using OAuth Providers +- **Google** – enabled by default. +- **Microsoft** – enable in your app's authentication settings before use. +- **Facebook** – enable in your app's authentication settings before use. + ```javascript // Initiate OAuth login flow base44.auth.loginWithProvider('google'); diff --git a/skills/base44-sdk/references/base44-agents.md b/skills/base44-sdk/references/base44-agents.md index ee55dee..b919bbf 100644 --- a/skills/base44-sdk/references/base44-agents.md +++ b/skills/base44-sdk/references/base44-agents.md @@ -23,9 +23,9 @@ AI agent conversations and messages via `base44.agents`. |--------|-----------|-------------| | `createConversation(params)` | `Promise` | Create a new conversation with an agent | | `getConversations()` | `Promise` | Get all user's conversations | -| `getConversation(id)` | `Promise` | Get conversation with messages | +| `getConversation(id)` | `Promise` | Get conversation with messages (includes full tool call results) | | `listConversations(filterParams)` | `Promise` | Filter/sort/paginate conversations | -| `subscribeToConversation(id, onUpdate?)` | `() => void` | Real-time updates via WebSocket (returns unsubscribe function) | +| `subscribeToConversation(id, onUpdate?)` | `() => void` | Realtime updates via WebSocket; tool call data truncated (returns unsubscribe function) | | `addMessage(conversation, message)` | `Promise` | Send a message | | `getWhatsAppConnectURL(agentName)` | `string` | Get WhatsApp connection URL for agent | @@ -57,6 +57,8 @@ conversations.forEach(conv => { ### Get Single Conversation (with messages) +Returns the complete stored conversation including full tool call results (unlike the realtime subscription, which truncates tool call data). + ```javascript const conversation = await base44.agents.getConversation("conv-id-123"); @@ -85,7 +87,9 @@ const highPriority = await base44.agents.listConversations({ }); ``` -### Subscribe to Updates (Real-time) +### Subscribe to Updates (Realtime) + +When receiving messages through this subscription, tool call data is truncated for efficiency (`arguments_string` limited to 500 characters, `results` to 50). Use `getConversation()` after the message completes to retrieve full tool call data. ```javascript const unsubscribe = base44.agents.subscribeToConversation( @@ -189,6 +193,24 @@ return () => unsubscribe(); ## Type Definitions +### AgentNameRegistry and AgentName + +**How to get typed agent names:** The Base44 CLI can generate an augmentation of `AgentNameRegistry` from your project. For how to run it, use the **base44-cli** skill. + +```typescript +/** + * Registry of agent names. + * Augment this interface to enable autocomplete for agent names. + * Typically populated by the Base44 CLI type generator. + */ +interface AgentNameRegistry {} + +/** + * Agent name type - uses registry keys if augmented, otherwise string. + */ +type AgentName = keyof AgentNameRegistry extends never ? string : keyof AgentNameRegistry; +``` + ### AgentConversation ```typescript @@ -311,7 +333,7 @@ interface AgentMessageMetadata { /** Parameters for creating a new conversation. */ interface CreateConversationParams { /** The name of the agent to create a conversation with. */ - agent_name: string; + agent_name: AgentName; /** Optional metadata to attach to the conversation. */ metadata?: Record; } @@ -343,7 +365,7 @@ interface AgentsModule { /** Gets all conversations from all agents in the app. */ getConversations(): Promise; - /** Gets a specific conversation by ID. */ + /** Gets a specific conversation by ID. Returns complete stored conversation including full tool call results. */ getConversation(conversationId: string): Promise; /** Lists conversations with filtering, sorting, and pagination. */ @@ -355,10 +377,10 @@ interface AgentsModule { /** Adds a message to a conversation. */ addMessage(conversation: AgentConversation, message: Partial): Promise; - /** Subscribes to real-time updates for a conversation. Returns unsubscribe function. */ + /** Subscribes to realtime updates for a conversation. Returns unsubscribe function. */ subscribeToConversation(conversationId: string, onUpdate?: (conversation: AgentConversation) => void): () => void; /** Gets WhatsApp connection URL for an agent. */ - getWhatsAppConnectURL(agentName: string): string; + getWhatsAppConnectURL(agentName: AgentName): string; } ``` diff --git a/skills/base44-sdk/references/client.md b/skills/base44-sdk/references/client.md index 554bf2b..cea56a4 100644 --- a/skills/base44-sdk/references/client.md +++ b/skills/base44-sdk/references/client.md @@ -13,7 +13,7 @@ How to create and configure the Base44 client. ## In Base44-Generated Apps -The client is pre-configured and available as `base44`. Just use it: +Inside a Base44 app, the client is automatically created and configured. Import it from `@/api/base44Client` and use it as `base44`: ```javascript const tasks = await base44.entities.Task.list(); @@ -21,7 +21,7 @@ const tasks = await base44.entities.Task.list(); ## In External Apps -Install the SDK and create a client: +When using Base44 as a backend from an external app, install the SDK and create a client by calling `createClient()` directly: ```bash npm install @base44/sdk @@ -52,7 +52,7 @@ const base44 = createClient({ ## In Backend Functions -Use `createClientFromRequest` to get a client with the caller's auth context: +`createClientFromRequest()` is designed for Base44-hosted backend functions. It extracts auth from request headers that Base44 injects and returns a client that includes service role access (`base44.asServiceRole`). For frontends and external backends, use `createClient()` instead. ```javascript import { createClientFromRequest } from "@base44/sdk"; @@ -127,22 +127,22 @@ Deno.serve(async (req) => { The client exposes these modules: ```javascript -base44.entities // CRUD operations -base44.auth // Authentication base44.agents // AI conversations -base44.functions // Backend function invocation -base44.integrations // Third-party services base44.analytics // Event tracking base44.appLogs // App usage logging +base44.auth // Authentication +base44.entities // CRUD operations +base44.functions // Backend function invocation +base44.integrations // Third-party services base44.users // User invitations // Service role only (backend) -base44.asServiceRole.entities base44.asServiceRole.agents -base44.asServiceRole.functions -base44.asServiceRole.integrations base44.asServiceRole.appLogs base44.asServiceRole.connectors +base44.asServiceRole.entities +base44.asServiceRole.functions +base44.asServiceRole.integrations ``` ## Client Methods @@ -204,7 +204,7 @@ interface CreateClientConfig { appId: string; /** User authentication token. Used to authenticate as a specific user. */ token?: string; - /** Service role authentication token (backend only). */ + /** @internal Service role token; only set automatically in Base44-hosted backend functions. */ serviceToken?: string; /** Additional client options. */ options?: CreateClientOptions; @@ -222,20 +222,20 @@ interface CreateClientOptions { ```typescript /** The Base44 client instance. */ interface Base44Client { - /** Entities module for CRUD operations on your data models. */ - entities: EntitiesModule; - /** Integrations module for calling pre-built integration endpoints. */ - integrations: IntegrationsModule; - /** Auth module for user authentication and management. */ - auth: AuthModule; - /** Functions module for invoking custom backend functions. */ - functions: FunctionsModule; /** Agents module for managing AI agent conversations. */ agents: AgentsModule; - /** App logs module for tracking app usage. */ - appLogs: AppLogsModule; /** Analytics module for tracking custom events. */ analytics: AnalyticsModule; + /** App logs module for tracking app usage. */ + appLogs: AppLogsModule; + /** Auth module for user authentication and management. */ + auth: AuthModule; + /** Entities module for CRUD operations on your data models. */ + entities: EntitiesModule; + /** Functions module for invoking custom backend functions. */ + functions: FunctionsModule; + /** Integrations module for calling pre-built integration methods. */ + integrations: IntegrationsModule; /** Cleanup function to disconnect WebSocket connections. */ cleanup(): void; @@ -245,12 +245,12 @@ interface Base44Client { /** Provides access to modules with elevated service role permissions (backend only). */ readonly asServiceRole: { - entities: EntitiesModule; - integrations: IntegrationsModule; - connectors: ConnectorsModule; - functions: FunctionsModule; agents: AgentsModule; appLogs: AppLogsModule; + connectors: ConnectorsModule; + entities: EntitiesModule; + functions: FunctionsModule; + integrations: IntegrationsModule; cleanup(): void; }; } diff --git a/skills/base44-sdk/references/entities.md b/skills/base44-sdk/references/entities.md index a7bdf35..6d9dcad 100644 --- a/skills/base44-sdk/references/entities.md +++ b/skills/base44-sdk/references/entities.md @@ -11,17 +11,19 @@ CRUD operations on data models. Access via `base44.entities.EntityName.method()` ## Methods +**Note:** The maximum limit for `list()` and `filter()` is 5,000 items per request. + | Method | Signature | Description | |--------|-----------|-------------| -| `create(data)` | `Promise` | Create one record | -| `bulkCreate(dataArray)` | `Promise` | Create multiple records | -| `list(sort?, limit?, skip?, fields?)` | `Promise` | Get all records (paginated) | -| `filter(query, sort?, limit?, skip?, fields?)` | `Promise` | Get records matching conditions | -| `get(id)` | `Promise` | Get single record by ID | -| `update(id, data)` | `Promise` | Update record (partial update) | -| `delete(id)` | `Promise` | Delete record by ID | -| `deleteMany(query)` | `Promise` | Delete all matching records | -| `importEntities(file)` | `Promise` | Import from CSV (frontend only) | +| `create(data)` | `Promise` | Create one record | +| `bulkCreate(dataArray)` | `Promise` | Create multiple records | +| `list(sort?, limit?, skip?, fields?)` | `Promise[]>` | Get all records (paginated) | +| `filter(query, sort?, limit?, skip?, fields?)` | `Promise[]>` | Get records matching conditions | +| `get(id)` | `Promise` | Get single record by ID | +| `update(id, data)` | `Promise` | Update record (partial update) | +| `delete(id)` | `Promise` | Delete record by ID | +| `deleteMany(query)` | `Promise` | Delete all matching records | +| `importEntities(file)` | `Promise>` | Import from CSV (frontend only) | | `subscribe(callback)` | `() => void` | Subscribe to realtime updates (returns unsubscribe function) | ## Examples @@ -48,9 +50,9 @@ const tasks = await base44.entities.Task.bulkCreate([ ### List with Pagination ```javascript -// Get first 10 records, sorted by created_date descending +// Get first 10 records, sorted by created_date descending (max 5,000 per request) const tasks = await base44.entities.Task.list( - "-created_date", // sort (string: prefix with - for descending) + "-created_date", // sort (SortField: prefix with - for descending) 10, // limit 0 // skip ); @@ -71,10 +73,10 @@ const myPending = await base44.entities.Task.filter({ assignedTo: userId }); -// With sort, limit, skip +// With sort, limit, skip (max 5,000 per request) const recent = await base44.entities.Task.filter( { status: "pending" }, - "-created_date", // sort (string: prefix with - for descending) + "-created_date", // sort (SortField: prefix with - for descending) 5, 0 ); @@ -109,10 +111,24 @@ await base44.entities.Task.update("task-id-123", { ```javascript // Single record -await base44.entities.Task.delete("task-id-123"); +const result = await base44.entities.Task.delete("task-id-123"); +console.log("Deleted:", result.success); // Multiple records matching query -await base44.entities.Task.deleteMany({ status: "archived" }); +const manyResult = await base44.entities.Task.deleteMany({ status: "archived" }); +console.log("Deleted:", manyResult.deleted); +``` + +### Import from File + +```javascript +// Frontend only: import from CSV/file +const result = await base44.entities.Task.importEntities(file); +if (result.status === "success" && result.output) { + console.log(`Imported ${result.output.length} records`); +} else { + console.error(result.details); +} ``` ### Subscribe to Realtime Updates @@ -187,11 +203,11 @@ RLS and FLS are configured in entity schema files (`base44/entities/*.jsonc`). S type RealtimeEventType = "create" | "update" | "delete"; /** Payload received when a realtime event occurs. */ -interface RealtimeEvent { +interface RealtimeEvent { /** The type of change that occurred. */ type: RealtimeEventType; /** The entity data. */ - data: any; + data: T; /** The unique identifier of the affected entity. */ id: string; /** ISO 8601 timestamp of when the event occurred. */ @@ -199,55 +215,137 @@ interface RealtimeEvent { } /** Callback function invoked when a realtime event occurs. */ -type RealtimeCallback = (event: RealtimeEvent) => void; +type RealtimeCallback = (event: RealtimeEvent) => void; +``` + +### Result Types -/** Function returned from subscribe, call it to unsubscribe. */ -type Subscription = () => void; +```typescript +/** Result returned when deleting a single entity. */ +interface DeleteResult { + /** Whether the deletion was successful. */ + success: boolean; +} + +/** Result returned when deleting multiple entities. */ +interface DeleteManyResult { + /** Whether the deletion was successful. */ + success: boolean; + /** Number of entities that were deleted. */ + deleted: number; +} + +/** Result returned when importing entities from a file. */ +interface ImportResult { + /** Status of the import operation. */ + status: "success" | "error"; + /** Details message, e.g., "Successfully imported 3 entities with RLS enforcement". */ + details: string | null; + /** Array of created entity objects when successful, or null on error. */ + output: T[] | null; +} +``` + +### SortField and Server Fields + +```typescript +/** + * Sort field type for entity queries. + * Supports ascending (no prefix or '+') and descending ('-') sorting. + * Example: 'created_date', '+created_date', '-created_date' + */ +type SortField = (keyof T & string) | `+${keyof T & string}` | `-${keyof T & string}`; + +/** Fields added by the server to every entity record. */ +interface ServerEntityFields { + id: string; + created_date: string; + updated_date: string; + created_by?: string | null; + created_by_id?: string | null; + is_sample?: boolean; +} +``` + +### Type Registry (for typed entities) + +**How to get typed entities:** The Base44 CLI can generate entity interfaces and an augmentation of `EntityTypeRegistry` from your project. For how to run it, use the **base44-cli** skill. + +```typescript +/** + * Registry mapping entity names to their TypeScript types. + * Augment this interface with your entity schema (user-defined fields only). + * Typically populated by the Base44 CLI type generator. + */ +interface EntityTypeRegistry {} + +/** + * Full record type for each entity: schema fields + server-injected fields. + */ +type EntityRecord = { + [K in keyof EntityTypeRegistry]: EntityTypeRegistry[K] & ServerEntityFields; +}; ``` ### EntityHandler ```typescript /** Entity handler providing CRUD operations for a specific entity type. */ -interface EntityHandler { - /** Lists records with optional pagination and sorting. */ - list(sort?: string, limit?: number, skip?: number, fields?: string[]): Promise; - - /** Filters records based on a query. */ - filter(query: Record, sort?: string, limit?: number, skip?: number, fields?: string[]): Promise; +interface EntityHandler { + /** Lists records with optional pagination and sorting. Max 5,000 per request. */ + list( + sort?: SortField, + limit?: number, + skip?: number, + fields?: K[] + ): Promise[]>; + + /** Filters records based on a query. Max 5,000 per request. */ + filter( + query: Partial, + sort?: SortField, + limit?: number, + skip?: number, + fields?: K[] + ): Promise[]>; /** Gets a single record by ID. */ - get(id: string): Promise; + get(id: string): Promise; /** Creates a new record. */ - create(data: Record): Promise; + create(data: Partial): Promise; /** Updates an existing record. */ - update(id: string, data: Record): Promise; + update(id: string, data: Partial): Promise; /** Deletes a single record by ID. */ - delete(id: string): Promise; + delete(id: string): Promise; /** Deletes multiple records matching a query. */ - deleteMany(query: Record): Promise; + deleteMany(query: Partial): Promise; /** Creates multiple records in a single request. */ - bulkCreate(data: Record[]): Promise; + bulkCreate(data: Partial[]): Promise; /** Imports records from a file (frontend only). */ - importEntities(file: File): Promise; + importEntities(file: File): Promise>; /** Subscribes to realtime updates. Returns unsubscribe function. */ - subscribe(callback: RealtimeCallback): Subscription; + subscribe(callback: RealtimeCallback): () => void; } ``` ### EntitiesModule ```typescript -/** Entities module for managing app data. */ -interface EntitiesModule { - /** Access any entity by name dynamically. */ - [entityName: string]: EntityHandler; -} +/** Entities module: typed registry keys get typed handlers; dynamic access remains untyped. */ +type EntitiesModule = TypedEntitiesModule & DynamicEntitiesModule; + +type TypedEntitiesModule = { + [K in keyof EntityTypeRegistry]: EntityHandler; +}; + +type DynamicEntitiesModule = { + [entityName: string]: EntityHandler; +}; ``` diff --git a/skills/base44-sdk/references/functions.md b/skills/base44-sdk/references/functions.md index 8072465..3e3e690 100644 --- a/skills/base44-sdk/references/functions.md +++ b/skills/base44-sdk/references/functions.md @@ -12,11 +12,11 @@ Invoke custom backend functions via `base44.functions`. ## Method ```javascript -base44.functions.invoke(functionName, data): Promise +base44.functions.invoke(functionName, data?): Promise ``` - `functionName`: Name of the backend function -- `data`: Object of parameters (sent as JSON, or multipart if contains File objects) +- `data`: Optional object of parameters (sent as JSON, or multipart if contains File objects) - Returns: Whatever the function returns ## Invoking Functions @@ -198,7 +198,21 @@ Inside the function, use `createClientFromRequest(req)` to get a client that inh ## Type Definitions +**How to get typed function names:** The Base44 CLI can generate an augmentation of `FunctionNameRegistry` from your project. For how to run it, use the **base44-cli** skill. + ```typescript +/** + * Registry of function names. + * Augment this interface to enable autocomplete for function names. + * Typically populated by the Base44 CLI type generator. + */ +interface FunctionNameRegistry {} + +/** + * Function name type - uses registry keys if augmented, otherwise string. + */ +type FunctionName = keyof FunctionNameRegistry extends never ? string : keyof FunctionNameRegistry; + /** Functions module for invoking custom backend functions. */ interface FunctionsModule { /** @@ -208,9 +222,9 @@ interface FunctionsModule { * sent as multipart/form-data. Otherwise, it will be sent as JSON. * * @param functionName - The name of the function to invoke. - * @param data - An object containing named parameters for the function. + * @param data - Optional object containing named parameters for the function. * @returns Promise resolving to the function's response. */ - invoke(functionName: string, data: Record): Promise; + invoke(functionName: FunctionName, data?: Record): Promise; } ``` diff --git a/skills/base44-sdk/references/integrations.md b/skills/base44-sdk/references/integrations.md index f356a18..9a9d552 100644 --- a/skills/base44-sdk/references/integrations.md +++ b/skills/base44-sdk/references/integrations.md @@ -174,7 +174,7 @@ Custom integrations allow workspace administrators to connect any external API b ```javascript const response = await base44.integrations.custom.call( slug, // Integration identifier (set by admin) - operationId, // Endpoint in "method:path" format + operationId, // Endpoint in "method:path" format (e.g. "get:/contacts", "post:/repos/{owner}/{repo}/issues") params // Optional: payload, pathParams, queryParams ); ``` @@ -328,16 +328,14 @@ interface CoreIntegrations { ### Custom Integrations ```typescript -/** Parameters for calling a custom integration endpoint. */ +/** Parameters for calling a custom integration method. */ interface CustomIntegrationCallParams { /** Request body payload. */ payload?: Record; - /** Path parameters to substitute in the URL. */ + /** Path parameters to substitute in the URL. For example, { owner: "user", repo: "repo" }. */ pathParams?: Record; /** Query string parameters. */ queryParams?: Record; - /** Additional headers for this request. */ - headers?: Record; } /** Response from a custom integration call. */ @@ -350,13 +348,13 @@ interface CustomIntegrationCallResponse { data: any; } -/** Module for calling custom workspace-level API integrations. */ +/** Module for calling custom pre-configured API integrations. */ interface CustomIntegrationsModule { /** - * Call a custom integration endpoint. - * @param slug - The integration's unique identifier. - * @param operationId - The operation ID from the OpenAPI spec. - * @param params - Optional payload, pathParams, queryParams, headers. + * Call a custom integration method. + * @param slug - The integration's unique identifier (set by workspace admin). + * @param operationId - The endpoint in "method:path" format (e.g. "get:/contacts", "post:/users/{id}"). + * @param params - Optional payload, pathParams, queryParams. */ call(slug: string, operationId: string, params?: CustomIntegrationCallParams): Promise; } @@ -365,7 +363,7 @@ interface CustomIntegrationsModule { ### IntegrationsModule ```typescript -/** Integrations module for calling integration endpoints. */ +/** Integrations module for calling integration methods. */ type IntegrationsModule = { /** Core package with built-in integrations. */ Core: CoreIntegrations;