from fediverse_service import FediverseService from misskey_service import MisskeyService from pleroma_service import PleromaService import config class FediverseServiceFactory: """Factory for creating FediverseService implementations based on configuration""" @staticmethod def create_service() -> FediverseService: """ Create a FediverseService implementation based on the configured instance type. Returns: FediverseService implementation (MisskeyService or PleromaService) Raises: ValueError: If the instance type is not supported """ if config.INSTANCE_TYPE == "misskey": return MisskeyService() elif config.INSTANCE_TYPE == "pleroma": return PleromaService() else: raise ValueError(f"Unsupported instance type: {config.INSTANCE_TYPE}") def get_fediverse_service() -> FediverseService: """Convenience function to get a FediverseService instance""" return FediverseServiceFactory.create_service()