22 lines
586 B
Python
22 lines
586 B
Python
"""Service for handling greeting-related business logic."""
|
|
|
|
|
|
class GreetingService:
|
|
"""Service for greeting operations."""
|
|
|
|
@staticmethod
|
|
def get_greeting(name: str | None = None) -> dict[str, str]:
|
|
"""Get a greeting message.
|
|
|
|
Args:
|
|
name: Optional name to personalize the greeting
|
|
|
|
Returns:
|
|
Dictionary containing the greeting message
|
|
"""
|
|
if name:
|
|
message = f"Hello, {name}!"
|
|
else:
|
|
message = "Hello from backend!"
|
|
|
|
return {"message": message} |