public with sharing class CheckWeather { @InvocableMethod( label='Check Weather' description='Check weather at Coral Cloud Resorts at a specific date' ) public static List getWeather( List requests ) { // Retrieve the date for which we want to check the weather Datetime dateToCheck = (Datetime) requests[0].dateToCheck; WeatherService.Weather weather = WeatherService.getResortWeather( dateToCheck ); // Create the response for Copilot WeatherResponse response = new WeatherResponse(); response.minTemperature = weather.minTemperatureC; response.maxTemperature = weather.maxTemperatureC; response.temperatureDescription = 'Temperatures will be between ' + weather.minTemperatureC + '°C (' + weather.minTemperatureF + '°F) and ' + weather.maxTemperatureC + '°C (' + weather.maxTemperatureF + '°F) at Coral Cloud.'; return new List{ response }; } public class WeatherRequest { @InvocableVariable( required=true description='Date for which we want to check the temperature. The variable needs to be an Apex Date type with format yyyy-MM-dd.' ) public Date dateToCheck; } public class WeatherResponse { @InvocableVariable( description='Minimum temperature in Celsius at Coral Cloud Resorts location for the provided date' ) public Decimal minTemperature; @InvocableVariable( description='Maximum temperature in Celsius at Coral Cloud Resorts location for the provided date' ) public Decimal maxTemperature; @InvocableVariable( description='Description of temperatures at Coral Cloud Resorts location for the provided date' ) public String temperatureDescription; } }