Welcome to Tafy Hub API Documentation
The Tafy Hub API is the backend service for the Tafy Studio Robot Distributed Operation System (RDOS).
API Reference
Core Modules
Application configuration using Pydantic Settings
- class app.core.config.Settings(_case_sensitive=None, _nested_model_default_partial_update=None, _env_prefix=None, _env_file=PosixPath('.'), _env_file_encoding=None, _env_ignore_empty=None, _env_nested_delimiter=None, _env_nested_max_split=None, _env_parse_none_str=None, _env_parse_enums=None, _cli_prog_name=None, _cli_parse_args=None, _cli_settings_source=None, _cli_parse_none_str=None, _cli_hide_none_type=None, _cli_avoid_json=None, _cli_enforce_required=None, _cli_use_class_docs_for_groups=None, _cli_exit_on_error=None, _cli_prefix=None, _cli_flag_prefix_char=None, _cli_implicit_flags=None, _cli_ignore_unknown_args=None, _cli_kebab_case=None, _cli_shortcuts=None, _secrets_dir=None, **values)[source]
Bases:
BaseSettings-
BACKEND_CORS_ORIGINS:
List[AnyHttpUrl]
- model_config: ClassVar[SettingsConfigDict] = {'arbitrary_types_allowed': True, 'case_sensitive': True, 'cli_avoid_json': False, 'cli_enforce_required': False, 'cli_exit_on_error': True, 'cli_flag_prefix_char': '-', 'cli_hide_none_type': False, 'cli_ignore_unknown_args': False, 'cli_implicit_flags': False, 'cli_kebab_case': False, 'cli_parse_args': None, 'cli_parse_none_str': None, 'cli_prefix': '', 'cli_prog_name': None, 'cli_shortcuts': None, 'cli_use_class_docs_for_groups': False, 'enable_decoding': True, 'env_file': '.env', 'env_file_encoding': 'utf-8', 'env_ignore_empty': False, 'env_nested_delimiter': None, 'env_nested_max_split': None, 'env_parse_enums': None, 'env_parse_none_str': None, 'env_prefix': '', 'extra': 'forbid', 'json_file': None, 'json_file_encoding': None, 'nested_model_default_partial_update': False, 'protected_namespaces': ('model_validate', 'model_dump', 'settings_customise_sources'), 'secrets_dir': None, 'toml_file': None, 'validate_default': True, 'yaml_config_section': None, 'yaml_file': None, 'yaml_file_encoding': None}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
BACKEND_CORS_ORIGINS:
NATS client singleton for the application
Database Models
Database models package
API Schemas
Pydantic schemas for request/response validation
- class app.schemas.DeviceCreate(**data)[source]
Bases:
DeviceBaseSchema for creating a device
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class app.schemas.DeviceUpdate(**data)[source]
Bases:
BaseModelSchema for updating a device
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class app.schemas.DeviceResponse(**data)[source]
Bases:
DeviceBaseSchema for device responses
-
status:
DeviceStatus
- model_config: ClassVar[ConfigDict] = {'from_attributes': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
status:
- class app.schemas.DeviceList(**data)[source]
Bases:
BaseModelSchema for device list responses
-
devices:
List[DeviceResponse]
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
devices:
- class app.schemas.FlowCreate(**data)[source]
Bases:
FlowBaseSchema for creating a flow
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class app.schemas.FlowUpdate(**data)[source]
Bases:
BaseModelSchema for updating a flow
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class app.schemas.FlowResponse(**data)[source]
Bases:
FlowBaseSchema for flow responses
- model_config: ClassVar[ConfigDict] = {'from_attributes': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class app.schemas.FlowDeploy(**data)[source]
Bases:
BaseModelSchema for flow deployment
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class app.schemas.SystemInfo(**data)[source]
Bases:
BaseModelSystem information schema
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class app.schemas.HealthCheck(**data)[source]
Bases:
BaseModelHealth check response schema
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
API Endpoints
Device management endpoints
- async app.api.v1.endpoints.devices.list_devices(status=Query(None))[source]
List all discovered devices
- async app.api.v1.endpoints.devices.update_device(device_id, update_data)[source]
Update device information
- async app.api.v1.endpoints.devices.send_command(device_id, command=Body(PydanticUndefined))[source]
Send command to device
Flow management endpoints for Node-RED integration
- async app.api.v1.endpoints.flows.list_flows(deployed_only=Query(False))[source]
List available flows
- async app.api.v1.endpoints.flows.update_flow(flow_id, update_data)[source]
Update flow configuration
Services
Business logic services
- class app.services.DeviceService[source]
Bases:
objectService for managing devices
- class app.services.FlowService[source]
Bases:
objectService for managing Node-RED flows