Class WeatherFunction
java.lang.Object
org.bsc.spring.agentexecutor.function.WeatherFunction
- All Implemented Interfaces:
Function<WeatherFunction.Request,
WeatherFunction.Response>
public class WeatherFunction
extends Object
implements Function<WeatherFunction.Request,WeatherFunction.Response>
Class representing the WeatherFunction which implements a
Function interface to retrieve weather data from an external API.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final record
Record representing weather conditions described in text form.static final record
Record representing current weather details as part of the weather response.static final record
Record representing location information as part of the weather response.static final record
Record representing the request object for WeatherFunction.static final record
Record representing the response object returned by the WeatherFunction. -
Constructor Summary
ConstructorDescriptionWeatherFunction
(WeatherConfig props) Constructor for the WeatherFunction class that initializes the necessary components based on provided configuration properties and logs relevant debug information. -
Method Summary
Modifier and TypeMethodDescriptionapply
(WeatherFunction.Request weatherRequest) Main method to apply the function, which retrieves weather data for a given city.
-
Constructor Details
-
WeatherFunction
Constructor for the WeatherFunction class that initializes the necessary components based on provided configuration properties and logs relevant debug information.- Parameters:
props
- Configuration properties for initializing the RestClient.
-
-
Method Details
-
apply
Main method to apply the function, which retrieves weather data for a given city.- Specified by:
apply
in interfaceFunction<WeatherFunction.Request,
WeatherFunction.Response> - Parameters:
weatherRequest
- The request object containing the city for which weather data is required.- Returns:
- The response object containing the retrieved weather data.
-