Mediloop
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

#MethodPurposeWhen it is calledMust implement
1initialize(context)Initialize connectorRuntime
2getCapabilities()Return capabilitiesRuntime
3connect()Open connectionRuntime
4disconnect()Close connectionRuntime
5healthCheck()Return health statusRuntime
6read(resourceType,id)Read resourceRuntime
7search(resourceType,query)Search resourcesRuntime
8write(resourceType,payload)Create/update resourceRuntime
9subscribe(events)Subscribe to eventsRuntime
10onEvent(event)Handle eventsRuntime
11beforeOperation(...) Pre-operation hookRuntime
12afterOperation(...)Post-operation hookRuntime
13handleError(error,ctx)Centralized error handlingRuntime
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.