CloudFunction class

CloudFunction client for executing server-side functions.

Cloud functions allow you to run custom server-side logic without managing infrastructure. Functions are written in Python and deployed to your Cocobase project.

Example:

// Access via the Cocobase instance
final db = Cocobase(CocobaseConfig(
  apiKey: 'your-api-key',
  projectId: 'your-project-id'
));

// Execute a function
final result = await db.functions.execute('sendEmail',
  payload: {'to': 'user@example.com', 'subject': 'Hello'},
  method: FunctionMethod.post
);

Constructors

CloudFunction(String projectId, String _getToken())
Creates a new CloudFunction client

Properties

hashCode int
The hash code for this object.
no setterinherited
projectId String
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

execute<T>(String functionName, {Map<String, dynamic>? payload, FunctionMethod? method}) Future<FunctionResponse<T>>
Execute a cloud function by name
get<T>(String functionName) Future<FunctionResponse<T>>
Execute a GET request to a cloud function
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
post<T>(String functionName, {Map<String, dynamic>? payload}) Future<FunctionResponse<T>>
Execute a POST request to a cloud function
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited