magically-sdk
Version:
Official SDK for Magically - Build mobile apps with AI
31 lines (30 loc) • 924 B
TypeScript
import { SDKConfig } from './types';
import { MagicallyAuth } from './MagicallyAuth';
export interface FunctionInvokeOptions {
headers?: Record<string, string>;
body?: any;
method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
}
export interface FunctionResponse<T = any> {
data?: T;
error?: {
message: string;
code?: string;
};
headers?: Record<string, string>;
status?: number;
}
export declare class MagicallyFunctions {
private config;
private auth;
private apiClient;
private logger;
private projectId;
constructor(config: SDKConfig, auth: MagicallyAuth);
/**
* Invoke a Cloudflare Worker function
* @param functionName - The name of the function to invoke
* @param options - Options for the function invocation
*/
invoke<T = any>(functionName: string, options?: FunctionInvokeOptions): Promise<FunctionResponse<T>>;
}