clients

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 28, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package clients is the composition-root wiring for outbound client capabilities. It adapts the public xdatly HTTP and MCP provider contracts to native Bindly input binding and owns the lifecycle of Datly's default implementations. Handlers declare

HTTP xhttp.Provider `bind:"kind=http_client,required"`
MCP  xmcp.Provider  `bind:"kind=mcp_client,required"`

and receive whichever provider the runtime composition registered. Nothing here inspects request values; a provider is either registered or the binding fails.

Index

Constants

View Source
const (
	// HTTPKind is the Bindly source kind that resolves xhttp.Provider.
	HTTPKind = "http_client"
	// MCPKind is the Bindly source kind that resolves xmcp.Provider.
	MCPKind = "mcp_client"
)

Variables

This section is empty.

Functions

func Providers

func Providers(http xhttp.Provider, mcp xmcp.Provider) []locator.Provider

Providers adapts explicit provider implementations to Bindly providers. A nil implementation registers nothing for its kind, so a handler that requires that capability fails its binding instead of receiving a hidden default.

Types

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry owns Datly's default HTTP and MCP client implementations. The composition root that creates it must Close it at shutdown; handlers only borrow the providers it exposes.

func New

func New() *Registry

New creates an empty default registry.

func (*Registry) Clients

func (r *Registry) Clients() int

Clients reports the number of distinct configured clients currently held.

func (*Registry) Close

func (r *Registry) Close() error

Close releases every client the registry created and refuses further resolution.

func (*Registry) HTTP

func (r *Registry) HTTP() xhttp.Provider

HTTP returns the default HTTP provider, or nil for a nil registry.

func (*Registry) MCP

func (r *Registry) MCP() xmcp.Provider

MCP returns the default MCP provider, or nil for a nil registry.

func (*Registry) Providers

func (r *Registry) Providers() []locator.Provider

Providers returns the Bindly providers for both default capabilities. A nil registry contributes nothing, so dependent bindings fail closed.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL