Skip to main content

HandlerInterface

Abstract Class
📁application_sdk.interfaces.handler

Abstract base class defining the contract that all handlers must fulfill. Ensures a consistent interface for the Application and Activities to interact with any handler, regardless of the underlying system. Handlers serve as the core implementation layer for a connector, containing system-specific interaction logic, client management, API implementation, and activity logic delegation.

Methods4

load

async
async load(self, *args, **kwargs) -> None
Initialize the handler and any required resources
Parameters
argstuple
Optional
Variable length argument list
kwargsdict
Optional
Keyword arguments containing credentials and configuration
Returns
None - No return value
Implementation Details

Typically loads the associated ClientInterface with credentials passed via kwargs

test_auth

async
/workflows/v1/auth
async test_auth(self, *args, **kwargs) -> bool
Verify that the provided credentials are valid for authenticating with the target system
Parameters
argstuple
Optional
Variable length argument list
kwargsdict
Optional
Keyword arguments containing authentication credentials
Returns
bool - True if authentication succeeds, False if it fails

preflight_check

async
/workflows/v1/check
async preflight_check(self, *args, **kwargs) -> dict
Perform necessary checks before starting a main workflow execution
Parameters
argstuple
Optional
Variable length argument list
kwargsdict
Optional
Keyword arguments containing configuration and filters
Returns
dict - Dictionary summarizing check results with success status and details
Implementation Details

Often includes verifying connectivity, checking permissions, validating configuration, or checking for required resources

fetch_metadata

async
/workflows/v1/metadata
async fetch_metadata(self, *args, **kwargs) -> Any
Fetch metadata from the target system
Parameters
argstuple
Optional
Variable length argument list
kwargsdict
Optional
Keyword arguments specifying metadata type and filters
Returns
Any - Fetched metadata, often as a list of dictionaries
Implementation Details

The specific type and format of metadata depend on the implementation and the arguments passed

Usage Examples

Application Integration

Handler instance is passed to APIServer constructor

app = APIServer(handler=MyConnectorHandler())

Activity Usage

Activities access handler through ActivitiesState

state = await self._get_state(...)
await state.handler.test_auth(**credentials)
metadata = await state.handler.fetch_metadata(**filters)