CONNECTOR SDK REFERENCE1 of 10
Connector Interface
The Connector Interface defines the contract every Mediloop connector must implement.
What is the Connector Interface?
It is the core TypeScript interface that your connector class must implement. The SDK will call these methods at runtime to initialize, authenticate, exchange data, handle events and manage the connector lifecycle.
Consistent contract across all connectors
Reliable communication and error handling
Observability, audit and compliance built-in
Asynchronous by default
Idempotent operations
Security and tenant isolation
typescriptCopy
export interface MediloopConnector {
initialize(context: ConnectorContext): Promise<void>;
getCapabilities(): Promise<ConnectorCapabilities>;
connect(): Promise<void>;
disconnect(): Promise<void>;
healthCheck(): Promise<HealthStatus>;
read(resourceType: string, id: string, options?: any): Promise<ReadResponse>;
search(resourceType: string, query: any, options?: any): Promise<SearchResponse>;
write(resourceType: string, payload: any, options?: any): Promise<WriteResponse>;
subscribe(events: string[]): Promise<void>;
onEvent(event: EventEnvelope): Promise<void>;
handleError(error: any, context: any): Promise<void>;
}Interface methods
1initialize
2getCapabilities
3connect / disconnect
4read / search / write
5subscribe / onEvent
6Lifecycle hooks
7handleError
Method reference
| # | Method | Purpose | When it is called | Must implement |
|---|---|---|---|---|
| 1 | initialize(context) | Initialize connector | Runtime | |
| 2 | getCapabilities() | Return capabilities | Runtime | |
| 3 | connect() | Open connection | Runtime | |
| 4 | disconnect() | Close connection | Runtime | |
| 5 | healthCheck() | Return health status | Runtime | |
| 6 | read(resourceType,id) | Read resource | Runtime | |
| 7 | search(resourceType,query) | Search resources | Runtime | |
| 8 | write(resourceType,payload) | Create/update resource | Runtime | |
| 9 | subscribe(events) | Subscribe to events | Runtime | |
| 10 | onEvent(event) | Handle events | Runtime | |
| 11 | beforeOperation(...) | Pre-operation hook | Runtime | |
| 12 | afterOperation(...) | Post-operation hook | Runtime | |
| 13 | handleError(error,ctx) | Centralized error handling | Runtime |
Connector context
tenantIdCurrent tenant identifier
environmentsandbox | production
configConnector configuration
secretsSecret values (never log)
loggerStructured logger
httpClientPreconfigured HTTP client
correlationIdRequest correlation ID
scopesGranted scopes
versionSDK version
Tip
Keep operations idempotent and handle retries. Use the SDK helpers for pagination, backoff and errors.